Skip to content

Commit

Permalink
passing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Akm0d authored and dwoz committed Sep 30, 2024
1 parent fa61bc3 commit e20d896
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions salt/client/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ def detect_os_arch(self):
f"Failed to detect OS and architecture. Commands failed with output: {stdout}, {stderr}"
)

log.info('Detected kernel "{}" and architecture "{}" on target'.format(kernel, os_arch))
log.info(f'Detected kernel "{kernel}" and architecture "{os_arch}" on target')

return kernel, os_arch

Expand Down Expand Up @@ -1572,7 +1572,6 @@ def _cmd_str(self):
cachedir = self.opts["_caller_cachedir"]
else:
cachedir = self.opts["cachedir"]

debug = ""
if not self.opts.get("log_level"):
self.opts["log_level"] = "info"
Expand Down Expand Up @@ -1622,7 +1621,6 @@ def _cmd_str(self):
)
py_code = SSH_PY_SHIM.replace("#%%OPTS", arg_str)
py_code_enc = base64.encodebytes(py_code.encode("utf-8")).decode("utf-8")

if not self.winrm:
cmd = SSH_SH_SHIM.format(
DEBUG=debug,
Expand Down
2 changes: 1 addition & 1 deletion salt/utils/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3227,7 +3227,7 @@ def _mixin_setup(self):
"custom grains/modules/states have been added or updated."
),
)
_ = self.add_option(
self.add_option(
"--relenv",
dest="relenv",
default=False,
Expand Down
10 changes: 5 additions & 5 deletions salt/utils/relenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def get_tarball(kernel, arch):
response = requests.get(base_url, timeout=60)
response.raise_for_status()
except requests.RequestException as e:
log.error("Failed to retrieve tarball listing: {}".format(e))
log.error(f"Failed to retrieve tarball listing: {e}")
raise ValueError("Unable to fetch tarball list from repository")

# Search for tarball filenames that match the kernel and arch
pattern = re.compile(rf'href="(salt-.*-onedir-{kernel}-{arch}\.tar\.xz)"')
matches = pattern.findall(response.text)
if not matches:
log.error("No tarballs found for {} and {}".format(kernel, arch))
raise ValueError("No tarball found for {} {}".format(kernel, arch))
log.error(f"No tarballs found for {kernel} and {arch}")
raise ValueError(f"No tarball found for {kernel} {arch}")

# Return the latest tarball URL
matches.sort()
Expand All @@ -76,7 +76,7 @@ def download(cachedir, url, destination):
Download the salt artifact from the given destination to the cache.
"""
if not os.path.exists(destination):
log.info("Downloading from {} to {}".format(url, destination))
log.info(f"Downloading from {url} to {destination}")
with salt.utils.files.fopen(destination, "wb+") as dest_file:
result = salt.utils.http.query(
url=url,
Expand All @@ -86,6 +86,6 @@ def download(cachedir, url, destination):
raise_error=True,
)
if result.get("status") != 200:
log.error("Failed to download file from {}".format(url))
log.error(f"Failed to download file from {url}")
return False
return True

0 comments on commit e20d896

Please sign in to comment.