Merge pull request #32174 from sjorge/2016.3-smartos-change

smartos state would show changes even if there were none
This commit is contained in:
Mike Place 2016-03-28 08:41:47 -06:00
commit 43ef524370

View File

@ -685,7 +685,7 @@ def vm_present(name, vmconfig, config=None):
if __opts__['test']: if __opts__['test']:
ret['changes'][vmconfig['state']['hostname']] = vmconfig['changed'] ret['changes'][vmconfig['state']['hostname']] = vmconfig['changed']
if len(ret['changes']) > 0: if vmconfig['state']['hostname'] in ret['changes'] and len(ret['changes'][vmconfig['state']['hostname']]) > 0:
ret['comment'] = 'vm {0} updated'.format(vmconfig['state']['hostname']) ret['comment'] = 'vm {0} updated'.format(vmconfig['state']['hostname'])
if config['kvm_reboot'] and vmconfig['current']['brand'] == 'kvm' and not __opts__['test']: if config['kvm_reboot'] and vmconfig['current']['brand'] == 'kvm' and not __opts__['test']:
if vmconfig['state']['hostname'] in __salt__['vmadm.list'](order='hostname', search='state=running'): if vmconfig['state']['hostname'] in __salt__['vmadm.list'](order='hostname', search='state=running'):
@ -693,6 +693,7 @@ def vm_present(name, vmconfig, config=None):
if kvm_needs_start: if kvm_needs_start:
__salt__['vmadm.start'](vm=vmconfig['state']['hostname'], key='hostname') __salt__['vmadm.start'](vm=vmconfig['state']['hostname'], key='hostname')
else: else:
ret['changes'] = {}
ret['comment'] = 'vm {0} is up to date'.format(vmconfig['state']['hostname']) ret['comment'] = 'vm {0} is up to date'.format(vmconfig['state']['hostname'])
if 'image_uuid' in vmconfig['current'] and vmconfig['reprovision_uuid'] != vmconfig['current']['image_uuid']: if 'image_uuid' in vmconfig['current'] and vmconfig['reprovision_uuid'] != vmconfig['current']['image_uuid']: