Fix flake8 again

This commit is contained in:
Matthew Treinish 2017-04-03 22:16:41 -04:00
parent 3b49bd5aa9
commit ea2bc36a72
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 1 additions and 2 deletions

View File

@ -49,12 +49,10 @@ class MQTTStat(threading.Thread):
self.client.username_pw_set(auth['username'],
password=auth.get('password'))
def run(self):
def on_connect(client, userdata, flags, rc):
client.subscribe(self.mqtt_topic)
def on_message(client, userdata, msg):
if self.statsd_type == 'gauge':
self.statsd_client.gauge(self.statsd_topic, msg.payload)
@ -62,6 +60,7 @@ class MQTTStat(threading.Thread):
self.statsd_client.timer(self.statsd_topic, msg.payload)
elif self.statsd_type == 'counter':
self.statsd_client.incr(self.statsd_topic)
self.client.on_connect = on_connect
self.client.on_message = on_message
self.client.connect(self.hostname, self.port)