mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
Run pyupgrade
against the files modified in the merge-forward
This commit is contained in:
parent
967d3015f6
commit
6fb799d38a
3 changed files with 11 additions and 13 deletions
|
@ -146,7 +146,7 @@ def _module_dirs(
|
|||
ext_type_types = []
|
||||
if ext_dirs:
|
||||
if ext_type_dirs is None:
|
||||
ext_type_dirs = "{}_dirs".format(tag)
|
||||
ext_type_dirs = f"{tag}_dirs"
|
||||
if ext_type_dirs in opts:
|
||||
ext_type_types.extend(opts[ext_type_dirs])
|
||||
if ext_type_dirs and load_extensions is True:
|
||||
|
@ -246,7 +246,7 @@ def _module_dirs(
|
|||
cli_module_dirs.insert(0, maybe_dir)
|
||||
continue
|
||||
|
||||
maybe_dir = os.path.join(_dir, "_{}".format(ext_type))
|
||||
maybe_dir = os.path.join(_dir, f"_{ext_type}")
|
||||
if os.path.isdir(maybe_dir):
|
||||
cli_module_dirs.insert(0, maybe_dir)
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ def grains(opts, force_refresh=False, proxy=None, context=None, loaded_base_name
|
|||
import salt.modules.cmdmod
|
||||
|
||||
# Make sure cache file isn't read-only
|
||||
salt.modules.cmdmod._run_quiet('attrib -R "{}"'.format(cfn))
|
||||
salt.modules.cmdmod._run_quiet(f'attrib -R "{cfn}"')
|
||||
with salt.utils.files.fopen(cfn, "w+b") as fp_:
|
||||
try:
|
||||
salt.payload.dump(grains_data, fp_)
|
||||
|
|
|
@ -182,7 +182,7 @@ def _render_filenames(path, dest, saltenv, template, **kw):
|
|||
# render the path as a template using path_template_engine as the engine
|
||||
if template not in salt.utils.templates.TEMPLATE_REGISTRY:
|
||||
raise CommandExecutionError(
|
||||
"Attempted to render file paths with unavailable engine {}".format(template)
|
||||
f"Attempted to render file paths with unavailable engine {template}"
|
||||
)
|
||||
|
||||
kwargs = {}
|
||||
|
|
|
@ -96,7 +96,7 @@ class AnsibleState:
|
|||
for mod_name, mod_params in kwargs.items():
|
||||
args, kwargs = self.get_args(mod_params)
|
||||
try:
|
||||
ans_mod_out = __salt__["ansible.{}".format(mod_name)](
|
||||
ans_mod_out = __salt__[f"ansible.{mod_name}"](
|
||||
**{"__pub_arg": [args, kwargs]}
|
||||
)
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
|
@ -170,7 +170,7 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
|
|||
ret = {
|
||||
"result": False,
|
||||
"changes": {},
|
||||
"comment": "Running playbook {}".format(name),
|
||||
"comment": f"Running playbook {name}",
|
||||
"name": name,
|
||||
}
|
||||
if git_repo:
|
||||
|
@ -197,13 +197,13 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
|
|||
not check["changed"] and not check["failures"] and not check["unreachable"]
|
||||
for check in checks["stats"].values()
|
||||
):
|
||||
ret["comment"] = "No changes to be made from playbook {}".format(name)
|
||||
ret["comment"] = f"No changes to be made from playbook {name}"
|
||||
ret["result"] = True
|
||||
elif any(
|
||||
check["changed"] and not check["failures"] and not check["unreachable"]
|
||||
for check in checks["stats"].values()
|
||||
):
|
||||
ret["comment"] = "Changes will be made from playbook {}".format(name)
|
||||
ret["comment"] = f"Changes will be made from playbook {name}"
|
||||
ret["result"] = None
|
||||
ret["changes"] = _changes(checks)
|
||||
else:
|
||||
|
@ -224,7 +224,7 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
|
|||
not check["changed"] and not check["failures"] and not check["unreachable"]
|
||||
for check in results["stats"].values()
|
||||
):
|
||||
ret["comment"] = "No changes to be made from playbook {}".format(name)
|
||||
ret["comment"] = f"No changes to be made from playbook {name}"
|
||||
ret["result"] = True
|
||||
ret["changes"] = _changes(results)
|
||||
else:
|
||||
|
@ -234,9 +234,7 @@ def playbooks(name, rundir=None, git_repo=None, git_kwargs=None, ansible_kwargs=
|
|||
for check in results["stats"].values()
|
||||
)
|
||||
if ret["result"]:
|
||||
ret["comment"] = "Changes were made by playbook {}".format(name)
|
||||
ret["comment"] = f"Changes were made by playbook {name}"
|
||||
else:
|
||||
ret[
|
||||
"comment"
|
||||
] = "There were some issues running the playbook {}".format(name)
|
||||
ret["comment"] = f"There were some issues running the playbook {name}"
|
||||
return ret
|
||||
|
|
Loading…
Add table
Reference in a new issue