Skip to content

Commit

Permalink
When we cannot get a property for a vSphere object return '(null)' as a
Browse files Browse the repository at this point in the history
string as other languages do not understand Python's None type
  • Loading branch information
dnaeon committed Sep 11, 2014
1 parent d6934b3 commit b241f31
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vpoller/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def about(self, msg):
else:
properties = msg['properties']

about = {prop: getattr(self.si.content.about, prop, None) for prop in properties}
about = {prop: getattr(self.si.content.about, prop, '(null)') for prop in properties}
result = {
'msg': 'Successfully retrieved properties',
'success': 0,
Expand Down Expand Up @@ -1281,7 +1281,7 @@ def vm_disk_discover(self, msg):
# Get the requested disk properties
result = {}
result['name'] = vm_name
result['disk'] = [{prop: getattr(disk, prop, None) for prop in properties} for disk in vm_disks]
result['disk'] = [{prop: getattr(disk, prop, '(null)') for prop in properties} for disk in vm_disks]

r = {
'success': 0,
Expand Down Expand Up @@ -1362,7 +1362,7 @@ def vm_guest_net_get(self, msg):
# Get the requested properties
result = {}
result['name'] = vm_name
result['net'] = [{prop: getattr(net, prop, None) for prop in properties} for net in vm_networks]
result['net'] = [{prop: getattr(net, prop, '(null)') for prop in properties} for net in vm_networks]

r = {
'success': 0,
Expand Down Expand Up @@ -1731,7 +1731,7 @@ def vm_process_get(self, msg):
# Get the requested process properties
result = {}
result['name'] = vm_name
result['process'] = [{prop: getattr(process, prop, None) for prop in properties} for process in vm_processes]
result['process'] = [{prop: getattr(process, prop, '(null)') for prop in properties} for process in vm_processes]

r = {
'success': 0,
Expand Down

0 comments on commit b241f31

Please sign in to comment.