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 2a334a6328
commit b76417d112
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ status = 0
max_count = 0
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"
for line in output.split("\n"):