mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-25 13:34:01 -07:00
[PR #9324/6cd3f79e backport][stable-10] lookup plugins: use f-strings (#9367)
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>
(cherry picked from commit 6cd3f79e19)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
74bd7f1471
commit
a5c448d6e8
31 changed files with 165 additions and 149 deletions
|
|
@ -105,7 +105,7 @@ class CyberarkPassword:
|
|||
self.extra_parms = []
|
||||
for key, value in kwargs.items():
|
||||
self.extra_parms.append('-p')
|
||||
self.extra_parms.append("%s=%s" % (key, value))
|
||||
self.extra_parms.append(f"{key}={value}")
|
||||
|
||||
if self.appid is None:
|
||||
raise AnsibleError("CyberArk Error: No Application ID specified")
|
||||
|
|
@ -130,8 +130,8 @@ class CyberarkPassword:
|
|||
all_parms = [
|
||||
CLIPASSWORDSDK_CMD,
|
||||
'GetPassword',
|
||||
'-p', 'AppDescs.AppID=%s' % self.appid,
|
||||
'-p', 'Query=%s' % self.query,
|
||||
'-p', f'AppDescs.AppID={self.appid}',
|
||||
'-p', f'Query={self.query}',
|
||||
'-o', self.output,
|
||||
'-d', self.b_delimiter]
|
||||
all_parms.extend(self.extra_parms)
|
||||
|
|
@ -144,7 +144,7 @@ class CyberarkPassword:
|
|||
b_credential = to_bytes(tmp_output)
|
||||
|
||||
if tmp_error:
|
||||
raise AnsibleError("ERROR => %s " % (tmp_error))
|
||||
raise AnsibleError(f"ERROR => {tmp_error} ")
|
||||
|
||||
if b_credential and b_credential.endswith(b'\n'):
|
||||
b_credential = b_credential[:-1]
|
||||
|
|
@ -164,7 +164,7 @@ class CyberarkPassword:
|
|||
except subprocess.CalledProcessError as e:
|
||||
raise AnsibleError(e.output)
|
||||
except OSError as e:
|
||||
raise AnsibleError("ERROR - AIM not installed or clipasswordsdk not in standard location. ERROR=(%s) => %s " % (to_text(e.errno), e.strerror))
|
||||
raise AnsibleError(f"ERROR - AIM not installed or clipasswordsdk not in standard location. ERROR=({to_text(e.errno)}) => {e.strerror} ")
|
||||
|
||||
return [result_dict]
|
||||
|
||||
|
|
@ -177,11 +177,11 @@ class LookupModule(LookupBase):
|
|||
"""
|
||||
|
||||
def run(self, terms, variables=None, **kwargs):
|
||||
display.vvvv("%s" % terms)
|
||||
display.vvvv(f"{terms}")
|
||||
if isinstance(terms, list):
|
||||
return_values = []
|
||||
for term in terms:
|
||||
display.vvvv("Term: %s" % term)
|
||||
display.vvvv(f"Term: {term}")
|
||||
cyberark_conn = CyberarkPassword(**term)
|
||||
return_values.append(cyberark_conn.get())
|
||||
return return_values
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue