Merge pull request #30965 from alprs/fix-rabbitmq_vhost_present_test

Fix rabbitmq_vhost.present result when test=True
This commit is contained in:
Nicole Thomas 2016-02-07 21:34:45 -07:00
commit 64125de6c7

View file

@ -70,24 +70,23 @@ def present(name):
vhost_exists = __salt__['rabbitmq.vhost_exists'](name)
if vhost_exists:
ret['comment'] = 'VHost {0} already exists'.format(name)
return ret
if __opts__['test']:
ret['result'] = None
if vhost_exists:
ret['comment'] = 'VHost {0} already exists'.format(name)
else:
ret['comment'] = 'Creating VHost {0}'.format(name)
ret['comment'] = 'Creating VHost {0}'.format(name)
ret['changes'] = {'old': '', 'new': name}
return ret
else:
if vhost_exists:
ret['comment'] = 'VHost {0} already exists'.format(name)
else:
result = __salt__['rabbitmq.add_vhost'](name)
if 'Error' in result:
ret['result'] = False
ret['comment'] = result['Error']
elif 'Added' in result:
ret['comment'] = result['Added']
ret['changes'] = {'old': '', 'new': name}
result = __salt__['rabbitmq.add_vhost'](name)
if 'Error' in result:
ret['result'] = False
ret['comment'] = result['Error']
elif 'Added' in result:
ret['comment'] = result['Added']
ret['changes'] = {'old': '', 'new': name}
return ret