Merge pull request #42998 from vernondcole/bugfix/ignore_missing_parent_directory

Routine fell back to eauth gently if keyfile was missing, but errored…
This commit is contained in:
Nicole Thomas 2017-08-23 09:36:46 -04:00 committed by GitHub
commit b3aa9ab394

View File

@ -189,15 +189,14 @@ class LocalClient(object):
key_user = key_user.replace(u'\\', u'_') key_user = key_user.replace(u'\\', u'_')
keyfile = os.path.join(self.opts[u'cachedir'], keyfile = os.path.join(self.opts[u'cachedir'],
u'.{0}_key'.format(key_user)) u'.{0}_key'.format(key_user))
try:
# Make sure all key parent directories are accessible # Make sure all key parent directories are accessible
salt.utils.verify.check_path_traversal(self.opts[u'cachedir'], salt.utils.verify.check_path_traversal(self.opts[u'cachedir'],
key_user, key_user,
self.skip_perm_errors) self.skip_perm_errors)
try:
with salt.utils.files.fopen(keyfile, u'r') as key: with salt.utils.files.fopen(keyfile, u'r') as key:
return key.read() return key.read()
except (OSError, IOError): except (OSError, IOError, SaltClientError):
# Fall back to eauth # Fall back to eauth
return u'' return u''