mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Merge pull request #27092 from perfinion/chdir-fix-2015.8
salt/master: chdir to root not homedir
This commit is contained in:
commit
100e340111
@ -387,22 +387,11 @@ class Master(SMaster):
|
|||||||
errors = []
|
errors = []
|
||||||
critical_errors = []
|
critical_errors = []
|
||||||
|
|
||||||
if salt.utils.is_windows() and self.opts['user'] == 'root':
|
|
||||||
# 'root' doesn't typically exist on Windows. Use the current user
|
|
||||||
# home directory instead.
|
|
||||||
home = os.path.expanduser('~' + salt.utils.get_user())
|
|
||||||
else:
|
|
||||||
home = os.path.expanduser('~' + self.opts['user'])
|
|
||||||
try:
|
try:
|
||||||
if salt.utils.is_windows() and not os.path.isdir(home):
|
os.chdir('/')
|
||||||
# On Windows, Service account home directories may not
|
|
||||||
# initially exist. If this is the case, make sure the
|
|
||||||
# directory exists before continuing.
|
|
||||||
os.mkdir(home, 0o755)
|
|
||||||
os.chdir(home)
|
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
errors.append(
|
errors.append(
|
||||||
'Cannot change to home directory {0} ({1})'.format(home, err)
|
'Cannot change to root directory ({1})'.format(err)
|
||||||
)
|
)
|
||||||
|
|
||||||
fileserver = salt.fileserver.Fileserver(self.opts)
|
fileserver = salt.fileserver.Fileserver(self.opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user