mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Merge pull request #2896 from jpmens/mqtt1
notification/mqtt: ensure network communication and check error
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user