mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Run pyupgrade
against the files being merged forwarded
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
50063ff617
commit
5843cb54eb
1 changed files with 3 additions and 3 deletions
|
@ -94,7 +94,7 @@ def write(data, path, saltenv="base", index=0):
|
|||
index of the file can be specified to write to a lower priority file root
|
||||
"""
|
||||
if saltenv not in __opts__["file_roots"]:
|
||||
return "Named environment {} is not present".format(saltenv)
|
||||
return f"Named environment {saltenv} is not present"
|
||||
if len(__opts__["file_roots"][saltenv]) <= index:
|
||||
return "Specified index {} in environment {} is not present".format(
|
||||
index, saltenv
|
||||
|
@ -106,10 +106,10 @@ def write(data, path, saltenv="base", index=0):
|
|||
root = __opts__["file_roots"][saltenv][index]
|
||||
dest = os.path.join(root, path)
|
||||
if not salt.utils.verify.clean_path(root, dest, subdir=True):
|
||||
return "Invalid path: {}".format(path)
|
||||
return f"Invalid path: {path}"
|
||||
dest_dir = os.path.dirname(dest)
|
||||
if not os.path.isdir(dest_dir):
|
||||
os.makedirs(dest_dir)
|
||||
with salt.utils.files.fopen(dest, "w+") as fp_:
|
||||
fp_.write(salt.utils.stringutils.to_str(data))
|
||||
return "Wrote data to file {}".format(dest)
|
||||
return f"Wrote data to file {dest}"
|
||||
|
|
Loading…
Add table
Reference in a new issue