From 60099a51251ab3f808621985198be268350c8aa1 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 7 Mar 2026 16:55:55 +0000 Subject: [PATCH] =?UTF-8?q?D=C3=A9claration=20=C3=A0=20agent1=20via=20MQTT?= =?UTF-8?q?=20(agents/register)=20au=20d=C3=A9marrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- agent2_deploy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/agent2_deploy.py b/agent2_deploy.py index 3b7f172..77f5144 100644 --- a/agent2_deploy.py +++ b/agent2_deploy.py @@ -46,6 +46,19 @@ def start_mqtt(): client_id=MQTT_CLIENT + "_pub") _mqtt_pub.connect(MQTT_HOST, MQTT_PORT) _mqtt_pub.loop_start() + register_to_agent1() + +def register_to_agent1(): + """Publie une déclaration de mise en ligne sur agents/register.""" + import json as _json + payload = _json.dumps({ + "agent" : MQTT_CLIENT, + "jid" : XMPP_JID, + "mqtt_inbox": cfg["mqtt_inbox"], + "speciality": "Déploiement d'agents : installe et configure d'autres agents sur des machines distantes ou locales via SSH", + }) + mqtt_publish("agents/register", payload) + print("[REGISTER] Déclaration envoyée à agent1.") def notify_agent1(agent_type: str, host: str, xmpp_jid: str, mqtt_inbox: str): """Informe agent1 du nouveau déploiement."""