Module: check_mk
Branch: master
Commit: 5a034c7dc8d95a69c456aeb69d7581b2ad90c26d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5a034c7dc8d95a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 17 10:48:42 2013 +0100
agent_vsphere.pysphere: More compatibility in case of not enough permissions
---
agents/special/agent_vsphere.pysphere | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/agents/special/agent_vsphere.pysphere
b/agents/special/agent_vsphere.pysphere
index 2e26e18..68284f8 100755
--- a/agents/special/agent_vsphere.pysphere
+++ b/agents/special/agent_vsphere.pysphere
@@ -640,12 +640,15 @@ def output_datastores():
# print inspect.getmembers(MORTypes)
print "<<<esx_vsphere_datastores:sep(%d)>>>" %
ord('\t')
- for mor in host._retrieve_properties_traversal(property_names=property_names,
obj_type=MORTypes.Datastore):
- for entry in mor.PropSet:
- if entry.Name == "name":
- print '[%s]' % entry.Val
- else:
- print '%s\t%s' % (entry.Name.split(".")[1], entry.Val)
+ rows = host._retrieve_properties_traversal(property_names=property_names,
obj_type=MORTypes.Datastore)
+ # if the user has no permission to host / datastores, rows is None, skip it then
+ if rows:
+ for mor in rows:
+ for entry in mor.PropSet:
+ if entry.Name == "name":
+ print '[%s]' % entry.Val
+ else:
+ print '%s\t%s' % (entry.Name.split(".")[1],
entry.Val)
def conv_multipath(value):
return " ".join(["%s %s" % (p.Name, p.PathState) for p in
value.HostMultipathStateInfoPath])