mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #30965 from alprs/fix-rabbitmq_vhost_present_test
Fix rabbitmq_vhost.present result when test=True
This commit is contained in:
commit
64125de6c7
1 changed files with 14 additions and 15 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue