1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-30 15:38:53 +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

@ -503,13 +503,13 @@ def main():
diff = None
obj = list(ldap_search(
'(&(objectClass=univentionShare)(cn={0}))'.format(name),
f'(&(objectClass=univentionShare)(cn={name}))',
attr=['cn']
))
exists = bool(len(obj))
container = 'cn=shares,ou={0},{1}'.format(module.params['ou'], base_dn())
dn = 'cn={0},{1}'.format(name, container)
container = f"cn=shares,ou={module.params['ou']},{base_dn()}"
dn = f'cn={name},{container}'
if state == 'present':
try:
@ -518,7 +518,7 @@ def main():
else:
obj = umc_module_for_edit('shares/share', dn)
module.params['printablename'] = '{0} ({1})'.format(name, module.params['host'])
module.params['printablename'] = f"{name} ({module.params['host']})"
for k in obj.keys():
if module.params[k] is True:
module.params[k] = '1'
@ -540,11 +540,7 @@ def main():
obj.modify()
except Exception as err:
module.fail_json(
msg='Creating/editing share {0} in {1} failed: {2}'.format(
name,
container,
err,
)
msg=f'Creating/editing share {name} in {container} failed: {err}'
)
if state == 'absent' and exists:
@ -555,11 +551,7 @@ def main():
changed = True
except Exception as err:
module.fail_json(
msg='Removing share {0} in {1} failed: {2}'.format(
name,
container,
err,
)
msg=f'Removing share {name} in {container} failed: {err}'
)
module.exit_json(