Module: check_mk
Branch: master
Commit: 1e9fe3664cb3816f94e14199bb379ee9d184e949
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1e9fe3664cb381…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Dec 10 13:16:29 2018 +0100
Re-use drain(). Added a few TODOs.
Change-Id: I68599fad22c573871ef5c6db0aa34825848bacbe
---
cmk/gui/htmllib.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/cmk/gui/htmllib.py b/cmk/gui/htmllib.py
index c2c8a89..985c77c 100644
--- a/cmk/gui/htmllib.py
+++ b/cmk/gui/htmllib.py
@@ -400,6 +400,7 @@ class OutputFunnel(object):
def _lowlevel_write(self, text):
raise NotImplementedError()
+ # TODO: Only use this and make plug()/unplug() private methods.
@contextmanager
def plugged(self):
self.plug()
@@ -420,7 +421,7 @@ class OutputFunnel(object):
# Get the sink content in order to do something with it.
def drain(self):
- if not self._is_plugged():
+ if not self._is_plugged(): # TODO: Raise exception or even remove "if"?
return ''
text = "".join(self.plug_text.pop())
@@ -428,12 +429,14 @@ class OutputFunnel(object):
return text
def unplug(self):
- if not self._is_plugged():
+ if not self._is_plugged(): # TODO: Raise exception or even remove "if"?
return
- text = "".join(self.plug_text.pop())
+ text = self.drain()
+ self.plug_text.pop()
self.write(text)
+ # TODO: Nuke this when we use plugged() exclusively.
def unplug_all(self):
while self._is_plugged():
self.unplug()
Module: check_mk
Branch: master
Commit: 59ad118a7ba783ef3b530df5b0cb2e11bfbb2f26
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=59ad118a7ba783…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Dec 10 12:34:07 2018 +0100
OutputFunnel.is_plugged() is an implementation detail.
Change-Id: I05a700128bd8d4def38b118203d86d3095c471ac
---
cmk/gui/htmllib.py | 12 ++++++------
tests/unit/cmk/gui/test_htmllib_OutputFunnel.py | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cmk/gui/htmllib.py b/cmk/gui/htmllib.py
index 0987d83..d5f9339 100644
--- a/cmk/gui/htmllib.py
+++ b/cmk/gui/htmllib.py
@@ -387,7 +387,7 @@ class OutputFunnel(object):
raise MKGeneralException(
_('Type Error: html.write accepts str and unicode input objects only!'))
- if self.is_plugged():
+ if self._is_plugged():
self.plug_text[self.plug_level].append(text)
else:
# encode when really writing out the data. Not when writing plugged,
@@ -417,12 +417,12 @@ class OutputFunnel(object):
self.plug_text.append([])
self.plug_level += 1
- def is_plugged(self):
+ def _is_plugged(self):
return self.plug_level > -1
# Pull the plug for a moment to allow the sink content to pass through.
def flush(self):
- if not self.is_plugged():
+ if not self._is_plugged():
return None
text = "".join(self.plug_text[self.plug_level])
@@ -433,7 +433,7 @@ class OutputFunnel(object):
# Get the sink content in order to do something with it.
def drain(self):
- if not self.is_plugged():
+ if not self._is_plugged():
return ''
text = "".join(self.plug_text[self.plug_level])
@@ -441,7 +441,7 @@ class OutputFunnel(object):
return text
def unplug(self):
- if not self.is_plugged():
+ if not self._is_plugged():
return
self.flush()
@@ -449,7 +449,7 @@ class OutputFunnel(object):
self.plug_level -= 1
def unplug_all(self):
- while self.is_plugged():
+ while self._is_plugged():
self.unplug()
diff --git a/tests/unit/cmk/gui/test_htmllib_OutputFunnel.py b/tests/unit/cmk/gui/test_htmllib_OutputFunnel.py
index 3dd238a..9bedae7 100644
--- a/tests/unit/cmk/gui/test_htmllib_OutputFunnel.py
+++ b/tests/unit/cmk/gui/test_htmllib_OutputFunnel.py
@@ -102,7 +102,7 @@ def test_output_funnel_context_raise(html):
except Exception as e:
assert "%s" % e == "Test exception"
finally:
- assert not html.is_plugged()
+ assert html.plug_text == []
def test_output_funnel_try_finally(html):
Module: check_mk
Branch: master
Commit: 45c883b676a6f879fd8bd0824257ec0a5fb02a01
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=45c883b676a6f8…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Dec 10 15:33:29 2018 +0100
agent_azure: minor changes in logging
Change-Id: I0682b0dec99abe84ce1efa260489c5250fc5f59f
---
agents/special/agent_azure | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/agents/special/agent_azure b/agents/special/agent_azure
index 25bcf03..019a460 100755
--- a/agents/special/agent_azure
+++ b/agents/special/agent_azure
@@ -378,12 +378,12 @@ class AzureMetric(object):
LOG.warning(msg + " for resource %s" % rid)
for measurement in reversed(metric.timeseries):
- LOG.debug("measurement: %s", measurement)
if not measurement.data:
continue
for aggr in AzureMetric.AGGREGATIONS:
for data in reversed(measurement.data):
+ LOG.debug("data: %s", data)
if hasattr(data, aggr):
value = getattr(data, aggr)
# the field *may* be present, even if we did not ask for it.
@@ -527,18 +527,20 @@ class AzureClient(object):
for m_def in self.discover_metrics(rid): # sort into categories
cat = self._categorize_metric(m_def)
categorized_metrics.setdefault(cat, []).append(m_def)
- LOG.debug("categorized_metrics = %r", categorized_metrics)
for time_grain in ('PT1M', 'PT1H'):
- metrics_no_dim = categorized_metrics.get('%s_no_dim' % time_grain)
+ metric_type = '%s_no_dim' % time_grain
+ metrics_no_dim = categorized_metrics.get(metric_type)
if metrics_no_dim:
_names = ','.join(m.name.value for m in metrics_no_dim)
+ LOG.debug("metrics of type %r: %r", metric_type, _names)
metrics += self._fetch_specific_metrics(rid, _names, time_grain, None, None, err)
- metrics_opt_dim = categorized_metrics.get('%s_opt_dim' % time_grain)
+ metric_type = '%s_opt_dim' % time_grain
+ metrics_opt_dim = categorized_metrics.get(metric_type)
if metrics_opt_dim:
_names = ','.join(m.name.value for m in metrics_opt_dim)
- LOG.info("These metrics have dimensions: %s", _names)
+ LOG.debug("metrics of type %r: %r", metric_type, _names)
metrics += self._fetch_specific_metrics(rid, _names, time_grain, None, None, err)
# TODO: dimension required. How does this work?
@@ -586,7 +588,6 @@ class AzureClient(object):
metrics += [
AzureMetric(metric, rid, time_grain, filters, err) for metric in raw.output.value
]
- LOG.debug("fetched metrics: %s", metricnames)
except ErrorResponseException as exc:
if self.args.debug:
raise exc
Module: check_mk
Branch: master
Commit: ad94bab315145e8c33a76dafd2623d8d57bbc698
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad94bab315145e…
Author: Andreas Umbreit <au(a)mathias-kettner.de>
Date: Mon Dec 10 17:01:58 2018 +0100
6933 FIX Always include xinetd configuration file to .tgz packages
Due to a bug in the packaging routine within the agent bakery, the Check_MK-Agent
xinetd configuration file wouldn't be included into .tgz packages.
This error occured when using the plugin "Installation paths for agent files"
while having no configured path starting with <code>/etc</code>.
The xinetd configuration file under <code>/etc/xinetd.d/</code> will now be included as intended,
regardless of the paths configured at the "Installation paths for agent files" ruleset.
CMK-1425
Change-Id: I7119bc08025ff99a8befdba436e6273f4d463d6c
---
.werks/6933 | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/.werks/6933 b/.werks/6933
new file mode 100644
index 0000000..85a0ad4
--- /dev/null
+++ b/.werks/6933
@@ -0,0 +1,19 @@
+Title: Always include xinetd configuration file to .tgz packages
+Level: 1
+Component: agents
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.6.0i1
+Date: 1544456159
+
+Due to a bug in the packaging routine within the agent bakery, the Check_MK-Agent
+xinetd configuration file wouldn't be included into .tgz packages.
+
+This error occured when using the plugin "Installation paths for agent files"
+while having no configured path starting with <code>/etc</code>.
+
+The xinetd configuration file under <code>/etc/xinetd.d/</code> will now be included as intended,
+regardless of the paths configured at the "Installation paths for agent files" ruleset.
+