Config is a dict so use get not getattr

The config file is a yaml and parsed into a dict. However there was a
mistake in the recent patch that treated it as a ConfigParser object and
used getattr to access the mqtt options. This doesn't work and needs to
just be a get to access the key from the dict. This commit does that so
now it should work without crashing.

Change-Id: Ia3613adb6a037c9d406e6e33361d6d5ee826c9cd
This commit is contained in:
Matthew Treinish 2017-04-13 22:33:10 -04:00
parent c06cdc8a8a
commit 5e8ec7ad3f
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 8 additions and 8 deletions

View File

@ -246,14 +246,14 @@ class Server(object):
self.config = config
self.gearman_host = self.config['gearman-host']
self.gearman_port = self.config['gearman-port']
mqtt_host = getattr(self.config, 'mqtt-host')
mqtt_port = getattr(self.config, 'mqtt-port', 1883)
mqtt_user = getattr(self.config, 'mqtt-user')
mqtt_pass = getattr(self.config, 'mqtt-pass')
mqtt_topic = getattr(self.config, 'mqtt-topic', 'gearman-subunit')
mqtt_ca_certs = getattr(self.config, 'mqtt-ca-certs')
mqtt_certfile = getattr(self.config, 'mqtt-certfile')
mqtt_keyfile = getattr(self.config, 'mqtt-keyfile')
mqtt_host = self.config.get('mqtt-host')
mqtt_port = self.config.get('mqtt-port', 1883)
mqtt_user = self.config.get('mqtt-user')
mqtt_pass = self.config.get('mqtt-pass')
mqtt_topic = self.config.get('mqtt-topic', 'gearman-subunit')
mqtt_ca_certs = self.config.get('mqtt-ca-certs')
mqtt_certfile = self.config.get('mqtt-certfile')
mqtt_keyfile = self.config.get('mqtt-keyfile')
self.mqtt = None
if mqtt_host:
auth = None