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
1f7ad41df7
commit
c9512a1853
2 changed files with 6 additions and 4 deletions
|
@ -158,13 +158,13 @@ def get_specific_user():
|
|||
user = get_user()
|
||||
if salt.utils.platform.is_windows():
|
||||
if _win_current_user_is_admin():
|
||||
return "sudo_{}".format(user)
|
||||
return f"sudo_{user}"
|
||||
else:
|
||||
env_vars = ("SUDO_USER",)
|
||||
if user == "root":
|
||||
for evar in env_vars:
|
||||
if evar in os.environ:
|
||||
return "sudo_{}".format(os.environ[evar])
|
||||
return f"sudo_{os.environ[evar]}"
|
||||
return user
|
||||
|
||||
|
||||
|
@ -182,7 +182,7 @@ def chugid(runas, group=None):
|
|||
target_pw_gid = grp.getgrnam(group).gr_gid
|
||||
except KeyError as err:
|
||||
raise CommandExecutionError(
|
||||
"Failed to fetch the GID for {}. Error: {}".format(group, err)
|
||||
f"Failed to fetch the GID for {group}. Error: {err}"
|
||||
)
|
||||
else:
|
||||
target_pw_gid = uinfo.pw_gid
|
||||
|
|
|
@ -9,7 +9,9 @@ from tests.support.mock import patch
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip_unless_on_linux(reason="Should only run in platforms which have duplicate GID support"),
|
||||
pytest.mark.skip_unless_on_linux(
|
||||
reason="Should only run in platforms which have duplicate GID support"
|
||||
),
|
||||
]
|
||||
def test_get_group_dict_with_improper_duplicate_root_group():
|
||||
with patch("salt.utils.user.get_group_list", return_value=["+", "root"]):
|
||||
|
|
Loading…
Add table
Reference in a new issue