From 998dd6aa312f9f79f49f66a3fa7491523f1ff7e9 Mon Sep 17 00:00:00 2001 From: twangboy Date: Mon, 5 Jun 2023 15:28:43 -0600 Subject: [PATCH] Don't use dunder modules in a salt util --- salt/utils/win_pwsh.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/salt/utils/win_pwsh.py b/salt/utils/win_pwsh.py index d17d6905993..b0e76d2aacf 100644 --- a/salt/utils/win_pwsh.py +++ b/salt/utils/win_pwsh.py @@ -1,13 +1,8 @@ -import logging - import salt.modules.cmdmod import salt.utils.json import salt.utils.platform from salt.exceptions import CommandExecutionError -__salt__ = {"cmd.run_all": salt.modules.cmdmod.run_all} -log = logging.getLogger(__name__) - __virtualname__ = "win_pwsh" @@ -43,7 +38,7 @@ def run_dict(cmd, cwd=None): cmd = f"{cmd} | ConvertTo-Json" if "progresspreference" not in cmd.lower(): cmd = f"$ProgressPreference = 'SilentlyContinue'; {cmd}" - ret = __salt__["cmd.run_all"](cmd, shell="powershell", cwd=cwd) + ret = salt.modules.cmdmod.run_all(cmd=cmd, shell="powershell", cwd=cwd) if "pid" in ret: del ret["pid"]