passing lint

This commit is contained in:
Tyler Levy Conde 2024-09-23 10:30:04 -06:00 committed by Daniel Wozniak
parent fa61bc361b
commit e20d896a13
3 changed files with 7 additions and 9 deletions

View file

@ -1192,7 +1192,7 @@ class Single:
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
@ -1572,7 +1572,6 @@ class Single:
cachedir = self.opts["_caller_cachedir"]
else:
cachedir = self.opts["cachedir"]
debug = ""
if not self.opts.get("log_level"):
self.opts["log_level"] = "info"
@ -1622,7 +1621,6 @@ ARGS = {arguments}\n'''.format(
)
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,

View file

@ -3227,7 +3227,7 @@ class SaltSSHOptionParser(
"custom grains/modules/states have been added or updated."
),
)
_ = self.add_option(
self.add_option(
"--relenv",
dest="relenv",
default=False,

View file

@ -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()
@ -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,
@ -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