From c632ed8250016ce71eb53a2a351c4cd4d2476cfc Mon Sep 17 00:00:00 2001 From: Brandon Myers Date: Tue, 13 Jun 2017 12:12:03 -0500 Subject: [PATCH] Fix mozillaLocation mq plugin --- mq/plugins/mozillaLocation.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mq/plugins/mozillaLocation.py b/mq/plugins/mozillaLocation.py index c3644bb8..780d7990 100644 --- a/mq/plugins/mozillaLocation.py +++ b/mq/plugins/mozillaLocation.py @@ -9,7 +9,7 @@ # Brandon Myers bmyers@mozilla.com import os -from configlib import getConfig, OptionParser +from configlib import getConfig class message(object): @@ -24,10 +24,8 @@ class message(object): self.priority = 5 config_location = os.path.join(os.path.dirname(os.path.abspath(__file__)), "mozillaLocation.conf") - parser = OptionParser() - (self.options, args) = parser.parse_args() - self.options.dc_code_list = getConfig('dc_code_list', '', config_location).split(',') - self.options.offices_code_list = getConfig('offices_code_list', '', config_location).split(',') + self.dc_code_list = getConfig('dc_code_list', '', config_location).split(',') + self.offices_code_list = getConfig('offices_code_list', '', config_location).split(',') def onMessage(self, message, metadata): if 'details' in message.keys() and 'hostname' in message['details'].keys(): @@ -35,9 +33,9 @@ class message(object): if len(hostnamesplit) == 5: if 'mozilla' == hostnamesplit[-2]: message['details']['site'] = hostnamesplit[-3] - if message['details']['site'] in self.options.dc_code_list: + if message['details']['site'] in self.dc_code_list: message['details']['sitetype'] = 'datacenter' - elif message['details']['site'] in self.options.offices_code_list: + elif message['details']['site'] in self.offices_code_list: message['details']['sitetype'] = 'office' else: message['details']['sitetype'] = 'unknown'