Support agents distants (SSH) pour !agentUPDATE/UPGRADE
- agent_update.py : _run_ssh() via sshpass, dispatche local ou SSH selon ssh_host - agent1.py : _get_agent_git_info() transmet ssh_host/ssh_user depuis le registre - agents_registry.json : agent2_test → ssh_host: 192.168.7.13, ssh_user: root Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -226,12 +226,15 @@ def _get_agent_git_info(name: str) -> dict:
|
||||
"install_path": agent.get("install_path", default_path),
|
||||
"service_name": agent.get("service_name", default_service),
|
||||
"git_branch" : agent.get("git_branch", "main"),
|
||||
"ssh_host" : agent.get("ssh_host"),
|
||||
"ssh_user" : agent.get("ssh_user", "root"),
|
||||
}
|
||||
|
||||
def _handle_update_one(name: str) -> str:
|
||||
from skills.agent_update import check_update
|
||||
info = _get_agent_git_info(name)
|
||||
return check_update(name, info["install_path"], info["git_branch"])
|
||||
return check_update(name, info["install_path"], info["git_branch"],
|
||||
info["ssh_host"], info["ssh_user"])
|
||||
|
||||
def _handle_update_all() -> str:
|
||||
from skills.agent_update import check_update
|
||||
@@ -242,7 +245,8 @@ def _handle_update_all() -> str:
|
||||
results = []
|
||||
for name in registry:
|
||||
info = _get_agent_git_info(name)
|
||||
results.append(check_update(name, info["install_path"], info["git_branch"]))
|
||||
results.append(check_update(name, info["install_path"], info["git_branch"],
|
||||
info["ssh_host"], info["ssh_user"]))
|
||||
return "\n\n".join(results) if results else "Aucun agent dans le registre."
|
||||
|
||||
def _handle_upgrade_one(name: str) -> str:
|
||||
@@ -250,7 +254,8 @@ def _handle_upgrade_one(name: str) -> str:
|
||||
info = _get_agent_git_info(name)
|
||||
self_upgrade = (name == "agent1")
|
||||
msg = do_upgrade(name, info["install_path"], info["service_name"],
|
||||
info["git_branch"], self_upgrade=self_upgrade)
|
||||
info["git_branch"], self_upgrade=self_upgrade,
|
||||
ssh_host=info["ssh_host"], ssh_user=info["ssh_user"])
|
||||
if self_upgrade and "Redémarrage en cours" in msg:
|
||||
# Envoyer le message XMPP avant le restart
|
||||
if xmpp_bot:
|
||||
@@ -276,7 +281,8 @@ def _handle_upgrade_all() -> str:
|
||||
agent1_info = (name, info) # traiter en dernier
|
||||
continue
|
||||
msg = do_upgrade(name, info["install_path"],
|
||||
info["service_name"], info["git_branch"])
|
||||
info["service_name"], info["git_branch"],
|
||||
ssh_host=info["ssh_host"], ssh_user=info["ssh_user"])
|
||||
results.append(msg)
|
||||
|
||||
summary = "\n\n".join(results) if results else "Aucun agent mis à jour."
|
||||
|
||||
Reference in New Issue
Block a user