Merge pull request #54327 from garethgreenaway/more_test_program_fixes

[2019.2.1] Catch the AccessDenied exception and continue when running under Py3.
This commit is contained in:
Daniel Wozniak 2019-08-29 09:59:33 -07:00 committed by GitHub
commit 490ee69f94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -816,6 +816,14 @@ class TestDaemon(TestProgram):
# Process exited between when process_iter was invoked and
# when we tried to invoke this instance's cmdline() func.
continue
except psutils.AccessDenied:
# We might get access denied if not running as root
if not salt.utils.platform.is_windows():
pinfo = proc.as_dict(attrs=['pid', 'name', 'username'])
log.error('Unable to access process %s, '
'running command %s as user %s',
pinfo['pid'], pinfo['name'], pinfo['username'])
continue
else:
cmd_len = len(cmdline)
for proc in psutils.process_iter():