Skip to content

Commit

Permalink
notification/mqtt: ensure network communication and check error
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmens committed May 12, 2013
1 parent 2a091a3 commit 98ddb1c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/notification/mqtt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def publish(module, topic, payload, server='localhost', port='1883', qos='0',
module.fail_json(msg="unable to connect to MQTT broker")

mqttc.publish(topic, payload, int(qos), retain)
rc = mqttc.loop()
if rc != 0:
module.fail_json(msg="unable to send to MQTT broker")

mqttc.disconnect()

Expand Down

0 comments on commit 98ddb1c

Please sign in to comment.