Module: check_mk
Branch: master
Commit: 533661f8e1c871acf8462b907003c05b98c69cbd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=533661f8e1c871…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Feb 6 16:37:01 2018 +0100
Fixed typo
Change-Id: I9c5e3024be6e5525785a45f41c3f30a6b35ea05a
---
cmk/structured_data.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmk/structured_data.py b/cmk/structured_data.py
index 76a0701..af36fa2 100644
--- a/cmk/structured_data.py
+++ b/cmk/structured_data.py
@@ -112,7 +112,7 @@ class StructuredDataTree(object):
def _validate_tree_path(self, tree_path):
if not tree_path:
raise MKGeneralException("Empty tree path or zero.")
- if not isinstance(tree_path, str) or not isinstance(tree_path, unicode):
+ if not (isinstance(tree_path, str) or isinstance(tree_path, unicode)):
raise MKGeneralException("Wrong tree path format. Must be of type string.")
if not (tree_path.endswith(":") or tree_path.endswith(".")):
raise MKGeneralException("No valid tree path.")
Module: check_mk
Branch: master
Commit: d77176505f8f2923e90a1c45456b8a26fb26da4a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d77176505f8f29…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Feb 6 16:34:14 2018 +0100
Use isinstance, not type
Change-Id: I36d485350c0fab9a7e4e7a3c72e97d6d893283b9
---
cmk/structured_data.py | 16 ++++++++--------
inventory/esx_vsphere_clusters | 1 +
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/cmk/structured_data.py b/cmk/structured_data.py
index ddb4eed..76a0701 100644
--- a/cmk/structured_data.py
+++ b/cmk/structured_data.py
@@ -112,7 +112,7 @@ class StructuredDataTree(object):
def _validate_tree_path(self, tree_path):
if not tree_path:
raise MKGeneralException("Empty tree path or zero.")
- if not type(tree_path) in [str, unicode]:
+ if not isinstance(tree_path, str) or not isinstance(tree_path, unicode):
raise MKGeneralException("Wrong tree path format. Must be of type string.")
if not (tree_path.endswith(":") or tree_path.endswith(".")):
raise MKGeneralException("No valid tree path.")
@@ -166,7 +166,7 @@ class StructuredDataTree(object):
else:
abs_path = tuple()
abs_path += (edge,)
- if type(attrs) == list:
+ if isinstance(attrs, list):
numeration = Numeration()
numeration.set_child_data(attrs)
parent.add_child(edge, numeration, abs_path)
@@ -185,11 +185,11 @@ class StructuredDataTree(object):
leaf_data = {}
sub_raw_tree = {}
for k, v in raw_entries.iteritems():
- if type(v) == dict:
+ if isinstance(v, dict):
# Dict based values mean that current key
# is a node.
sub_raw_tree.setdefault(k, v)
- elif type(v) == list:
+ elif isinstance(v, list):
# Concerns "a.b:" and "a.b:*.c".
# In the second case we have to deal with nested numerations
# We take a look at children which may be real numerations
@@ -208,7 +208,7 @@ class StructuredDataTree(object):
def _is_numeration(self, entries):
for entry in entries:
for k, v in entry.iteritems():
- if type(v) == list:
+ if isinstance(v, list):
return False
return True
@@ -459,7 +459,7 @@ class Container(NodeAttribute):
def _is_nested_numeration_tree(self, child):
if isinstance(child, Container):
for key in child._edges.keys():
- if type(key) == int:
+ if isinstance(key, int):
return True
return False
@@ -489,7 +489,7 @@ numerated nodes ('arrays') containing real numerations ('devices').
def _has_nested_numeration_node(self, node_data):
for nr, entry in enumerate(node_data):
for k, v in entry.iteritems():
- if type(v) == list:
+ if isinstance(v, list):
return True
return False
@@ -500,7 +500,7 @@ numerated nodes ('arrays') containing real numerations ('devices').
for nr, entry in enumerate(child_data):
attrs = {}
for k, v in entry.iteritems():
- if type(v) == list:
+ if isinstance(v, list):
numeration = parent.add_child(nr, Container(), abs_path+(nr,))\
.add_child(k, Numeration(), abs_path+(nr,k))
numeration.set_child_data(v)
diff --git a/inventory/esx_vsphere_clusters b/inventory/esx_vsphere_clusters
index 71b4637..93b836c 100644
--- a/inventory/esx_vsphere_clusters
+++ b/inventory/esx_vsphere_clusters
@@ -49,6 +49,7 @@ def inv_esx_vsphere_clusters(info):
data["clusters"].append(dict([("name", cluster)] + values.items()))
node.append(data)
+
inv_info['esx_vsphere_clusters'] = {
"inv_function" : inv_esx_vsphere_clusters,
}
Module: check_mk
Branch: master
Commit: 29f3fbf19c96e6167e0256f3f7dad4bd9d95b8ea
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29f3fbf19c96e6…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Feb 6 11:36:35 2018 +0100
Simplification
Change-Id: I6b927ff9e69eb8fd6c0f8c09144dd794f16f23a8
---
agents/mk-job | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/agents/mk-job b/agents/mk-job
index 5328154..c53b0e0 100755
--- a/agents/mk-job
+++ b/agents/mk-job
@@ -67,8 +67,7 @@ date +"start_time %s" > "$OUTPUT_PATH/$IDENT.running" 2>/dev/null
if [ ! -w "$OUTPUT_PATH/$IDENT.running" ] ; then
# Looks like we are lacking the permissions to create this file..
# In this scenario no mk-job status file is created. We simply execute the command
- "$@"
- exit $?
+ exec "$@"
fi