mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Cleaning up tag compare, getting fully qualified path for executable
This commit is contained in:
parent
32c7fa7f70
commit
5a4ff6ca60
1 changed files with 3 additions and 14 deletions
|
@ -106,6 +106,7 @@ class RabbitMqUser(object):
|
||||||
|
|
||||||
self._tags = None
|
self._tags = None
|
||||||
self._permissions = None
|
self._permissions = None
|
||||||
|
self._rabbitmqctl = module.get_bin_path("rabbitmqctl", True)
|
||||||
|
|
||||||
def _exec(self, args):
|
def _exec(self, args):
|
||||||
cmd = ["rabbitmqctl", "-q"]
|
cmd = ["rabbitmqctl", "-q"]
|
||||||
|
@ -147,7 +148,6 @@ class RabbitMqUser(object):
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
self._exec(["add_user", self.username, self.password])
|
self._exec(["add_user", self.username, self.password])
|
||||||
|
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
self._exec(["delete_user", self.username])
|
self._exec(["delete_user", self.username])
|
||||||
|
@ -168,18 +168,7 @@ class RabbitMqUser(object):
|
||||||
self._exec(cmd)
|
self._exec(cmd)
|
||||||
|
|
||||||
def has_tags_modifications(self):
|
def has_tags_modifications(self):
|
||||||
if (not self._tags and len(self.tags) > 0) or (not self.tags and len(self._tags) > 0):
|
return set(self.tags) != set(self._tags)
|
||||||
return True
|
|
||||||
else:
|
|
||||||
for tag in self._tags:
|
|
||||||
if tag not in self.tags:
|
|
||||||
return True
|
|
||||||
|
|
||||||
for tag in self.tags:
|
|
||||||
if tag not in self._tags:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def has_permissions_modifications(self):
|
def has_permissions_modifications(self):
|
||||||
return self._permissions != self.permissions
|
return self._permissions != self.permissions
|
||||||
|
@ -238,7 +227,7 @@ def main():
|
||||||
rabbitmq_user.set_permissions()
|
rabbitmq_user.set_permissions()
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
module.exit_json(changed=changed)
|
module.exit_json(changed=changed, user=username, state=state)
|
||||||
|
|
||||||
# this is magic, see lib/ansible/module_common.py
|
# this is magic, see lib/ansible/module_common.py
|
||||||
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||||
|
|
Loading…
Reference in a new issue