1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-28 14:39:07 +00:00

modules [t-z]*: use f-strings (#10978)

* modules [t-z]*: use f-strings

* add changelog frag

* remove extraneous file
This commit is contained in:
Alexei Znamensky 2025-10-26 22:36:03 +13:00 committed by GitHub
parent af246f8de3
commit adcc683da7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 514 additions and 536 deletions

View file

@ -122,18 +122,18 @@ def main():
diff = None
groups = list(ldap_search(
'(&(objectClass=posixGroup)(cn={0}))'.format(name),
f'(&(objectClass=posixGroup)(cn={name}))',
attr=['cn']
))
if position != '':
container = position
else:
if ou != '':
ou = 'ou={0},'.format(ou)
ou = f'ou={ou},'
if subpath != '':
subpath = '{0},'.format(subpath)
container = '{0}{1}{2}'.format(subpath, ou, base_dn())
group_dn = 'cn={0},{1}'.format(name, container)
subpath = f'{subpath},'
container = f'{subpath}{ou}{base_dn()}'
group_dn = f'cn={name},{container}'
exists = bool(len(groups))
@ -154,7 +154,7 @@ def main():
grp.modify()
except Exception:
module.fail_json(
msg="Creating/editing group {0} in {1} failed".format(name, container)
msg=f"Creating/editing group {name} in {container} failed"
)
if state == 'absent' and exists:
@ -165,7 +165,7 @@ def main():
changed = True
except Exception:
module.fail_json(
msg="Removing group {0} failed".format(name)
msg=f"Removing group {name} failed"
)
module.exit_json(