mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix pre-commit
This commit is contained in:
parent
7b07640b32
commit
e8ccb262a6
2 changed files with 8 additions and 12 deletions
|
@ -111,9 +111,7 @@ def _find_chocolatey():
|
|||
os.path.join(
|
||||
os.environ.get("ProgramData"), "Chocolatey", "bin", "chocolatey.exe"
|
||||
),
|
||||
os.path.join(
|
||||
os.environ.get("ProgramData"), "Chocolatey", "bin", "choco.exe"
|
||||
),
|
||||
os.path.join(os.environ.get("ProgramData"), "Chocolatey", "bin", "choco.exe"),
|
||||
os.path.join(
|
||||
os.environ.get("SystemDrive"), "Chocolatey", "bin", "chocolatey.bat"
|
||||
),
|
||||
|
@ -210,7 +208,7 @@ def bootstrap(force=False, source=None):
|
|||
except CommandExecutionError:
|
||||
choc_path = None
|
||||
if choc_path and not force:
|
||||
return "Chocolatey found at {}".format(choc_path)
|
||||
return f"Chocolatey found at {choc_path}"
|
||||
|
||||
temp_dir = tempfile.gettempdir()
|
||||
|
||||
|
@ -338,7 +336,7 @@ def bootstrap(force=False, source=None):
|
|||
|
||||
if not os.path.exists(script):
|
||||
raise CommandExecutionError(
|
||||
"Failed to find Chocolatey installation script: {}".format(script)
|
||||
f"Failed to find Chocolatey installation script: {script}"
|
||||
)
|
||||
|
||||
# Run the Chocolatey bootstrap
|
||||
|
@ -380,7 +378,7 @@ def unbootstrap():
|
|||
if os.path.exists(choco_dir):
|
||||
log.debug("Removing Chocolatey directory: %s", choco_dir)
|
||||
__salt__["file.remove"](path=choco_dir, force=True)
|
||||
removed.append("Removed Directory: {}".format(choco_dir))
|
||||
removed.append(f"Removed Directory: {choco_dir}")
|
||||
else:
|
||||
known_paths = [
|
||||
os.path.join(os.environ.get("ProgramData"), "Chocolatey"),
|
||||
|
@ -390,7 +388,7 @@ def unbootstrap():
|
|||
if os.path.exists(path):
|
||||
log.debug("Removing Chocolatey directory: %s", path)
|
||||
__salt__["file.remove"](path=path, force=True)
|
||||
removed.append("Removed Directory: {}".format(path))
|
||||
removed.append(f"Removed Directory: {path}")
|
||||
|
||||
# Delete all Chocolatey environment variables
|
||||
for env_var in __salt__["environ.items"]():
|
||||
|
@ -402,14 +400,14 @@ def unbootstrap():
|
|||
__salt__["environ.setval"](
|
||||
key=env_var, val=False, false_unsets=True, permanent="HKCU"
|
||||
)
|
||||
removed.append("Removed Environment Var: {}".format(env_var))
|
||||
removed.append(f"Removed Environment Var: {env_var}")
|
||||
|
||||
# Remove Chocolatey from the path:
|
||||
for path in __salt__["win_path.get_path"]():
|
||||
if "chocolatey" in path.lower():
|
||||
log.debug("Removing Chocolatey path item: %s", path)
|
||||
__salt__["win_path.remove"](path=path, rehash=True)
|
||||
removed.append("Removed Path Item: {}".format(path))
|
||||
removed.append(f"Removed Path Item: {path}")
|
||||
|
||||
return removed
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@ def chocolatey_path_pd():
|
|||
|
||||
@pytest.fixture(scope="module")
|
||||
def choco_path_pd():
|
||||
return os.path.join(
|
||||
os.environ.get("ProgramData"), "Chocolatey", "bin", "choco.exe"
|
||||
)
|
||||
return os.path.join(os.environ.get("ProgramData"), "Chocolatey", "bin", "choco.exe")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
|
Loading…
Add table
Reference in a new issue