diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index 7d36faea39d..140b8bc58cd 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -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 @@ -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" @@ -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, diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index 7f061b1c36c..304a2c4ec40 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -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, diff --git a/salt/utils/relenv.py b/salt/utils/relenv.py index 25ef16d0679..ff07b25c97a 100644 --- a/salt/utils/relenv.py +++ b/salt/utils/relenv.py @@ -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