mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Better error handling and a workaround for group mismatch.
This commit is contained in:
parent
5b56a4acf7
commit
6f53232e6d
2 changed files with 10 additions and 4 deletions
|
@ -44,7 +44,8 @@ The information which can be stored in a roster ``target`` is the following:
|
|||
sudo: # Boolean to run command via sudo
|
||||
sudo_user: # Str: Set this to execute Salt as a sudo user other than root.
|
||||
# This user must be in the same system group as the remote user
|
||||
# that is used to login and is specified above.
|
||||
# that is used to login and is specified above. Alternatively,
|
||||
# the user must be a super-user.
|
||||
tty: # Boolean: Set this option to True if sudo is also set to
|
||||
# True and requiretty is also set on the target system
|
||||
priv: # File path to ssh private key, defaults to salt-ssh.rsa
|
||||
|
|
|
@ -65,9 +65,14 @@ def need_deployment():
|
|||
# If SUDOing then also give the super user group write permissions
|
||||
sudo_gid = os.environ.get('SUDO_GID')
|
||||
if sudo_gid:
|
||||
os.chown(OPTIONS.saltdir, -1, int(sudo_gid))
|
||||
stt = os.stat(OPTIONS.saltdir)
|
||||
os.chmod(OPTIONS.saltdir, stt.st_mode | stat.S_IWGRP | stat.S_IRGRP | stat.S_IXGRP)
|
||||
try:
|
||||
os.chown(OPTIONS.saltdir, -1, int(sudo_gid))
|
||||
stt = os.stat(OPTIONS.saltdir)
|
||||
os.chmod(OPTIONS.saltdir, stt.st_mode | stat.S_IWGRP | stat.S_IRGRP | stat.S_IXGRP)
|
||||
except OSError:
|
||||
sys.stdout.write('\n\nUnable to set permissions on thin directory.\nIf sudo_user is set '
|
||||
'and is not root, be certain the user is in the same group\nas the login user')
|
||||
sys.exit(1)
|
||||
|
||||
# Delimiter emitted on stdout *only* to indicate shim message to master.
|
||||
sys.stdout.write("{0}\ndeploy\n".format(OPTIONS.delimiter))
|
||||
|
|
Loading…
Add table
Reference in a new issue