mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
chore(mac_brew_pkg): apply lint fixes
Applied lint patch suggested by this CI job: https://github.com/saltstack/salt/actions/runs/5298983857/jobs/9593574724?pr=57946 Signed-off-by: Antonio Ramón Sánchez Morales <antonioramonsm@gmail.com>
This commit is contained in:
parent
2a522420ca
commit
b258510a6d
1 changed files with 10 additions and 8 deletions
|
@ -97,7 +97,9 @@ def _homebrew_bin():
|
|||
"""
|
||||
Returns the full path to the homebrew binary in the PATH
|
||||
"""
|
||||
ret = __salt__["cmd.run"](salt.utils.path.which("brew")+" --prefix", output_loglevel="trace")
|
||||
ret = __salt__["cmd.run"](
|
||||
salt.utils.path.which("brew") + " --prefix", output_loglevel="trace"
|
||||
)
|
||||
ret += "/bin/brew"
|
||||
return ret
|
||||
|
||||
|
@ -110,7 +112,7 @@ def _call_brew(*cmd, failhard=True):
|
|||
runas = user if user != __opts__["user"] else None
|
||||
_cmd = []
|
||||
if runas:
|
||||
_cmd = ["sudo -i -n -H -u {} -- ".format(runas)]
|
||||
_cmd = [f"sudo -i -n -H -u {runas} -- "]
|
||||
_cmd = _cmd + [_homebrew_bin()] + list(cmd)
|
||||
_cmd = " ".join(_cmd)
|
||||
|
||||
|
@ -496,7 +498,7 @@ def list_upgrades(refresh=True, include_casks=False, **kwargs): # pylint: disab
|
|||
try:
|
||||
data = salt.utils.json.loads(res["stdout"])
|
||||
except ValueError as err:
|
||||
msg = 'unable to interpret output from "brew outdated": {}'.format(err)
|
||||
msg = f'unable to interpret output from "brew outdated": {err}'
|
||||
log.error(msg)
|
||||
raise CommandExecutionError(msg)
|
||||
|
||||
|
@ -637,11 +639,11 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
|
|||
ret[target] = {"name": target, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
if target not in installed:
|
||||
ret[target]["comment"] = "Package {} does not have a state.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} does not have a state."
|
||||
elif target not in pinned:
|
||||
if "test" in __opts__ and __opts__["test"]:
|
||||
ret[target].update(result=None)
|
||||
ret[target]["comment"] = "Package {} is set to be held.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} is set to be held."
|
||||
else:
|
||||
result = _pin(target)
|
||||
if result:
|
||||
|
@ -652,7 +654,7 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
|
|||
)
|
||||
else:
|
||||
ret[target].update(result=False)
|
||||
ret[target]["comment"] = "Unable to hold package {}.".format(target)
|
||||
ret[target]["comment"] = f"Unable to hold package {target}."
|
||||
else:
|
||||
ret[target].update(result=True)
|
||||
ret[target]["comment"] = "Package {} is already set to be held.".format(
|
||||
|
@ -713,7 +715,7 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
|
|||
ret[target] = {"name": target, "changes": {}, "result": False, "comment": ""}
|
||||
|
||||
if target not in installed:
|
||||
ret[target]["comment"] = "Package {} does not have a state.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} does not have a state."
|
||||
elif target in pinned:
|
||||
if "test" in __opts__ and __opts__["test"]:
|
||||
ret[target].update(result=None)
|
||||
|
@ -727,7 +729,7 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
|
|||
ret[target].update(changes=changes, result=True)
|
||||
ret[target][
|
||||
"comment"
|
||||
] = "Package {} is no longer being held.".format(target)
|
||||
] = f"Package {target} is no longer being held."
|
||||
else:
|
||||
ret[target].update(result=False)
|
||||
ret[target]["comment"] = "Unable to unhold package {}.".format(
|
||||
|
|
Loading…
Add table
Reference in a new issue