mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Ensured `changed
returns
False
`. (#1530)
* Ensured ``changed`` returns ``False``. - Added small improvement on the ``_load_scope()`` method. * yamllint caught it * Rephrased changelog fragment
This commit is contained in:
parent
50aead4636
commit
1faf8ef08b
2 changed files with 11 additions and 13 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- ldap_search - the module no longer incorrectly reports a change (https://github.com/ansible-collections/community.general/issues/1040).
|
|
@ -112,7 +112,7 @@ def main():
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
module.fail_json(msg="Attribute action failed.", details=to_native(exception))
|
module.fail_json(msg="Attribute action failed.", details=to_native(exception))
|
||||||
|
|
||||||
module.exit_json(changed=True)
|
module.exit_json(changed=False)
|
||||||
|
|
||||||
|
|
||||||
def _extract_entry(dn, attrs):
|
def _extract_entry(dn, attrs):
|
||||||
|
@ -144,24 +144,20 @@ class LdapSearch(LdapGeneric):
|
||||||
self.attrsonly = 0
|
self.attrsonly = 0
|
||||||
|
|
||||||
def _load_scope(self):
|
def _load_scope(self):
|
||||||
scope = self.module.params['scope']
|
spec = dict(
|
||||||
if scope == 'base':
|
base=ldap.SCOPE_BASE,
|
||||||
self.scope = ldap.SCOPE_BASE
|
onelevel=ldap.SCOPE_ONELEVEL,
|
||||||
elif scope == 'onelevel':
|
subordinate=ldap.SCOPE_SUBORDINATE,
|
||||||
self.scope = ldap.SCOPE_ONELEVEL
|
children=ldap.SCOPE_SUBTREE,
|
||||||
elif scope == 'subordinate':
|
)
|
||||||
self.scope = ldap.SCOPE_SUBORDINATE
|
self.scope = spec[self.module.params['scope']]
|
||||||
elif scope == 'children':
|
|
||||||
self.scope = ldap.SCOPE_SUBTREE
|
|
||||||
else:
|
|
||||||
raise AssertionError('Implementation error')
|
|
||||||
|
|
||||||
def _load_attrs(self):
|
def _load_attrs(self):
|
||||||
self.attrlist = self.module.params['attrs'] or None
|
self.attrlist = self.module.params['attrs'] or None
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
results = self.perform_search()
|
results = self.perform_search()
|
||||||
self.module.exit_json(changed=True, results=results)
|
self.module.exit_json(changed=False, results=results)
|
||||||
|
|
||||||
def perform_search(self):
|
def perform_search(self):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue