From d4f2e5baa737968880a3cd2312ff2a56fcc15f62 Mon Sep 17 00:00:00 2001 From: Mike Place Date: Thu, 12 May 2016 14:02:00 -0600 Subject: [PATCH] Don't try to kill a parent proc if we can't --- salt/scripts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/salt/scripts.py b/salt/scripts.py index 97918c999f..b257660a00 100644 --- a/salt/scripts.py +++ b/salt/scripts.py @@ -68,10 +68,12 @@ def minion_process(queue): time.sleep(5) try: # check pid alive (Unix only trick!) - os.kill(parent_pid, 0) - except OSError: + if os.getuid() == 0 and not salt.utils.is_windows(): + os.kill(parent_pid, 0) + except OSError as exc: # forcibly exit, regular sys.exit raises an exception-- which # isn't sufficient in a thread + log.error('Minion process encountered exception: {0}'.format(exc)) os._exit(999) if not salt.utils.is_windows(): thread = threading.Thread(target=suicide_when_without_parent, args=(os.getppid(),))