mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 04:00:21 -07:00
lookup plugins: use f-strings (#9324)
* lookup plugins: use f-strings * add changelog frag * manual change for few occurrences * Update plugins/lookup/dependent.py Co-authored-by: Felix Fontein <felix@fontein.de> * adjustment from review * no f-string for you * Update plugins/lookup/dependent.py Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
2005125af4
commit
6cd3f79e19
31 changed files with 165 additions and 149 deletions
|
@ -168,7 +168,7 @@ def etcd3_client(client_params):
|
|||
etcd = etcd3.client(**client_params)
|
||||
etcd.status()
|
||||
except Exception as exp:
|
||||
raise AnsibleLookupError('Cannot connect to etcd cluster: %s' % (to_native(exp)))
|
||||
raise AnsibleLookupError(f'Cannot connect to etcd cluster: {to_native(exp)}')
|
||||
return etcd
|
||||
|
||||
|
||||
|
@ -204,7 +204,7 @@ class LookupModule(LookupBase):
|
|||
cnx_log = dict(client_params)
|
||||
if 'password' in cnx_log:
|
||||
cnx_log['password'] = '<redacted>'
|
||||
display.verbose("etcd3 connection parameters: %s" % cnx_log)
|
||||
display.verbose(f"etcd3 connection parameters: {cnx_log}")
|
||||
|
||||
# connect to etcd3 server
|
||||
etcd = etcd3_client(client_params)
|
||||
|
@ -218,12 +218,12 @@ class LookupModule(LookupBase):
|
|||
if val and meta:
|
||||
ret.append({'key': to_native(meta.key), 'value': to_native(val)})
|
||||
except Exception as exp:
|
||||
display.warning('Caught except during etcd3.get_prefix: %s' % (to_native(exp)))
|
||||
display.warning(f'Caught except during etcd3.get_prefix: {to_native(exp)}')
|
||||
else:
|
||||
try:
|
||||
val, meta = etcd.get(term)
|
||||
if val and meta:
|
||||
ret.append({'key': to_native(meta.key), 'value': to_native(val)})
|
||||
except Exception as exp:
|
||||
display.warning('Caught except during etcd3.get: %s' % (to_native(exp)))
|
||||
display.warning(f'Caught except during etcd3.get: {to_native(exp)}')
|
||||
return ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue