mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Run pre-commit after base change
This commit is contained in:
parent
d9b25d475d
commit
9f34246960
4 changed files with 12 additions and 16 deletions
|
@ -498,10 +498,10 @@ def dot_vals(value):
|
|||
"""
|
||||
ret = {}
|
||||
for key, val in __pillar__.get("master", {}).items():
|
||||
if key.startswith("{}.".format(value)):
|
||||
if key.startswith(f"{value}."):
|
||||
ret[key] = val
|
||||
for key, val in __opts__.items():
|
||||
if key.startswith("{}.".format(value)):
|
||||
if key.startswith(f"{value}."):
|
||||
ret[key] = val
|
||||
return ret
|
||||
|
||||
|
|
|
@ -816,7 +816,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 = {}
|
||||
|
|
|
@ -173,7 +173,7 @@ def renderer(path=None, string=None, default_renderer="jinja|yaml", **kwargs):
|
|||
default_renderer,
|
||||
__opts__["renderer_blacklist"],
|
||||
__opts__["renderer_whitelist"],
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
return ret.read() if salt.utils.stringio.is_readable(ret) else ret
|
||||
|
||||
|
@ -185,12 +185,12 @@ def _get_serialize_fn(serializer, fn_name):
|
|||
|
||||
if not fns:
|
||||
raise salt.exceptions.CommandExecutionError(
|
||||
"Serializer '{}' not found.".format(serializer)
|
||||
f"Serializer '{serializer}' not found."
|
||||
)
|
||||
|
||||
if not fn:
|
||||
raise salt.exceptions.CommandExecutionError(
|
||||
"Serializer '{}' does not implement {}.".format(serializer, fn_name)
|
||||
f"Serializer '{serializer}' does not implement {fn_name}."
|
||||
)
|
||||
|
||||
return fn
|
||||
|
@ -419,7 +419,7 @@ def findup(startpath, filenames, saltenv="base"):
|
|||
# Verify the cwd is a valid path in the state tree
|
||||
if startpath and not path_exists(startpath, saltenv):
|
||||
raise salt.exceptions.SaltInvocationError(
|
||||
"Starting path not found in the state tree: {}".format(startpath)
|
||||
f"Starting path not found in the state tree: {startpath}"
|
||||
)
|
||||
|
||||
# Ensure that patterns is a string or list of strings
|
||||
|
|
|
@ -202,7 +202,7 @@ def _setup(fs_root, cache_root):
|
|||
|
||||
path = os.path.join(saltenv_root, "foo.txt")
|
||||
with salt.utils.files.fopen(path, "w") as fp_:
|
||||
fp_.write("This is a test file in the '{}' saltenv.\n".format(saltenv))
|
||||
fp_.write(f"This is a test file in the '{saltenv}' saltenv.\n")
|
||||
(Path(saltenv_root) / "dirtofile").touch()
|
||||
(Path(saltenv_root) / "filetodir").mkdir()
|
||||
(Path(saltenv_root) / "filetodir" / "foo.sh").touch()
|
||||
|
@ -235,7 +235,7 @@ def test_cache_dir(client, cache_root):
|
|||
Ensure entire directory is cached to correct location
|
||||
"""
|
||||
for saltenv in _saltenvs():
|
||||
assert client.cache_dir("salt://{}".format(SUBDIR), saltenv, cachedir=None)
|
||||
assert client.cache_dir(f"salt://{SUBDIR}", saltenv, cachedir=None)
|
||||
for subdir_file in _subdir_files():
|
||||
cache_loc = os.path.join(
|
||||
cache_root,
|
||||
|
@ -282,9 +282,7 @@ def test_cache_dir_with_alternate_cachedir_and_absolute_path(
|
|||
alt_cachedir = os.path.join(tmp_path, "abs_cachedir")
|
||||
|
||||
for saltenv in _saltenvs():
|
||||
assert client.cache_dir(
|
||||
"salt://{}".format(SUBDIR), saltenv, cachedir=alt_cachedir
|
||||
)
|
||||
assert client.cache_dir(f"salt://{SUBDIR}", saltenv, cachedir=alt_cachedir)
|
||||
for subdir_file in _subdir_files():
|
||||
cache_loc = os.path.join(
|
||||
cache_root,
|
||||
|
@ -326,9 +324,7 @@ def test_cache_dir_with_alternate_cachedir_and_relative_path(client, cache_root)
|
|||
alt_cachedir = "foo"
|
||||
|
||||
for saltenv in _saltenvs():
|
||||
assert client.cache_dir(
|
||||
"salt://{}".format(SUBDIR), saltenv, cachedir=alt_cachedir
|
||||
)
|
||||
assert client.cache_dir(f"salt://{SUBDIR}", saltenv, cachedir=alt_cachedir)
|
||||
for subdir_file in _subdir_files():
|
||||
cache_loc = os.path.join(
|
||||
cache_root,
|
||||
|
@ -488,7 +484,7 @@ def test_cache_dest(client, cache_root):
|
|||
)
|
||||
|
||||
def _check(ret, expected):
|
||||
assert ret == expected, "{} != {}".format(ret, expected)
|
||||
assert ret == expected, f"{ret} != {expected}"
|
||||
|
||||
_check(client.cache_dest(f"https://{relpath}"), _external())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue