Check for USER env var before accessing it

(imported from commit 6274eeee98026701bafc55b919fe9354536a413b)
This commit is contained in:
Leo Franchi 2013-03-22 16:05:44 -04:00
parent a1b74e9fd7
commit 78b14d16ee

View file

@ -27,7 +27,7 @@ status = 0
max_count = 0 max_count = 0
warn_queues = [] warn_queues = []
if not environ['USER'] in ['root', 'rabbitmq']: if 'USER' in environ and not environ['USER'] in ['root', 'rabbitmq']:
print "This script must be run as the root or rabbitmq user" print "This script must be run as the root or rabbitmq user"
for line in output.split("\n"): for line in output.split("\n"):