mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
If the path does not exist. Let us know.
This commit is contained in:
parent
91e254d2a6
commit
f46d8c5d6c
@ -353,13 +353,17 @@ def check_path_traversal(path, user='root'):
|
||||
for tpath in list_path_traversal(path):
|
||||
if not os.access(tpath, os.R_OK):
|
||||
msg = 'Could not access {0}.'.format(tpath)
|
||||
if not os.path.exists(tpath):
|
||||
msg += ' Path does not exist.'
|
||||
else:
|
||||
current_user = getpass.getuser()
|
||||
# Make the error message more intelligent based on how
|
||||
# the user invokes salt-call or whatever other script.
|
||||
if user != current_user:
|
||||
msg += ' Try running as user {0}.'.format(user)
|
||||
else:
|
||||
msg += ' Please give {0} read permissions.'.format(user, tpath)
|
||||
msg += ' Please give {0} read permissions.'.format(user,
|
||||
tpath)
|
||||
# Propagate this exception up so there isn't a sys.exit()
|
||||
# in the middle of code that could be imported elsewhere.
|
||||
raise SaltClientError(msg)
|
||||
|
Loading…
Reference in New Issue
Block a user