From 98ddb1ca6bdedf241103a192f9d1e40b01643ed4 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sun, 12 May 2013 11:22:34 +0200 Subject: [PATCH] notification/mqtt: ensure network communication and check error --- library/notification/mqtt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/notification/mqtt b/library/notification/mqtt index efe4557198a..7ac687a2fe3 100644 --- a/library/notification/mqtt +++ b/library/notification/mqtt @@ -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()