mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-30 15:38:53 +00:00
modules [jk]*: use f-strings (#10970)
* modules [jk]*: use f-strings * add changelog frag * Apply suggestions from code review * typing insanity
This commit is contained in:
parent
8120e9347e
commit
4a6a449fbd
46 changed files with 363 additions and 408 deletions
|
|
@ -81,10 +81,9 @@ except ImportError:
|
|||
|
||||
|
||||
def _alternate_retrieval_method(module):
|
||||
get_argument = 'echo "%s" | gnome-keyring-daemon --unlock\nkeyring get %s %s\n' % (
|
||||
quote(module.params["keyring_password"]),
|
||||
quote(module.params["service"]),
|
||||
quote(module.params["username"]),
|
||||
get_argument = (
|
||||
f'echo "{quote(module.params["keyring_password"])}" | gnome-keyring-daemon --unlock\n'
|
||||
f'keyring get {quote(module.params["service"])} {quote(module.params["username"])}\n'
|
||||
)
|
||||
dummy, stdout, dummy = module.run_command(
|
||||
"dbus-run-session -- /bin/bash",
|
||||
|
|
@ -129,16 +128,10 @@ def run_module():
|
|||
passphrase = _alternate_retrieval_method(module)
|
||||
|
||||
if passphrase is not None:
|
||||
result["msg"] = "Successfully retrieved password for %s@%s" % (
|
||||
module.params["service"],
|
||||
module.params["username"],
|
||||
)
|
||||
result["msg"] = f"Successfully retrieved password for {module.params['service']}@{module.params['username']}"
|
||||
result["passphrase"] = passphrase
|
||||
if passphrase is None:
|
||||
result["msg"] = "Password for %s@%s does not exist." % (
|
||||
module.params["service"],
|
||||
module.params["username"],
|
||||
)
|
||||
result["msg"] = f"Password for {module.params['service']}@{module.params['username']} does not exist."
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue