Fix differences with devel.

This commit is contained in:
Matt Clay 2016-12-08 09:38:05 -05:00
parent 1c9a58a885
commit c709b22e5c
32 changed files with 78 additions and 237 deletions

View file

@ -519,24 +519,24 @@ class PyVmomiHelper(object):
def set_powerstate(self, vm, state, force):
"""
Set the power status for a VM determined by the current and
requested states. force is forceful
"""
"""
Set the power status for a VM determined by the current and
requested states. force is forceful
"""
facts = self.gather_facts(vm)
expected_state = state.replace('_', '').lower()
current_state = facts['hw_power_status'].lower()
result = {}
# Need Force
if not force and current_state not in ['poweredon', 'poweredoff']:
return "VM is in %s power state. Force is required!" % current_state
# Need Force
if not force and current_state not in ['poweredon', 'poweredoff']:
return "VM is in %s power state. Force is required!" % current_state
# State is already true
if current_state == expected_state:
# State is already true
if current_state == expected_state:
result['changed'] = False
result['failed'] = False
else:
else:
task = None
try:
if expected_state == 'poweredoff':
@ -602,20 +602,20 @@ class PyVmomiHelper(object):
else:
facts['ipv4'] = ipaddress
for idx,entry in enumerate(vm.config.hardware.device):
if not hasattr(entry, 'macAddress'):
continue
for idx,entry in enumerate(vm.config.hardware.device):
if not hasattr(entry, 'macAddress'):
continue
factname = 'hw_eth' + str(idx)
facts[factname] = {
'addresstype': entry.addressType,
'label': entry.deviceInfo.label,
'macaddress': entry.macAddress,
'ipaddresses': netDict.get(entry.macAddress, None),
'macaddress_dash': entry.macAddress.replace(':', '-'),
'summary': entry.deviceInfo.summary,
}
facts['hw_interfaces'].append('eth'+str(idx))
factname = 'hw_eth' + str(idx)
facts[factname] = {
'addresstype': entry.addressType,
'label': entry.deviceInfo.label,
'macaddress': entry.macAddress,
'ipaddresses': netDict.get(entry.macAddress, None),
'macaddress_dash': entry.macAddress.replace(':', '-'),
'summary': entry.deviceInfo.summary,
}
facts['hw_interfaces'].append('eth'+str(idx))
return facts