mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Don't try to chown
if the user salt
does not exist
This commit is contained in:
parent
036f2c3f58
commit
857dbeba1d
1 changed files with 15 additions and 7 deletions
|
@ -476,13 +476,21 @@ def salt_minion(salt_factories, salt_master, install_salt):
|
|||
# which sets root perms on /srv/salt and /srv/pillar since we are running
|
||||
# the test suite as root, but we want to run Salt master as salt
|
||||
if not platform.is_windows() and not platform.is_darwin():
|
||||
state_tree = "/srv/salt"
|
||||
pillar_tree = "/srv/pillar"
|
||||
check_paths = [state_tree, pillar_tree, CODE_DIR / ".nox"]
|
||||
for path in check_paths:
|
||||
if os.path.exists(path) is False:
|
||||
continue
|
||||
subprocess.run(["chown", "-R", "salt:salt", str(path)], check=False)
|
||||
import pwd
|
||||
|
||||
try:
|
||||
pwd.getpwnam("salt")
|
||||
except KeyError:
|
||||
# The salt user does not exist
|
||||
pass
|
||||
else:
|
||||
state_tree = "/srv/salt"
|
||||
pillar_tree = "/srv/pillar"
|
||||
check_paths = [state_tree, pillar_tree, CODE_DIR / ".nox"]
|
||||
for path in check_paths:
|
||||
if os.path.exists(path) is False:
|
||||
continue
|
||||
subprocess.run(["chown", "-R", "salt:salt", str(path)], check=False)
|
||||
|
||||
factory.after_terminate(
|
||||
pytest.helpers.remove_stale_minion_key, salt_master, factory.id
|
||||
|
|
Loading…
Add table
Reference in a new issue