Skip to content

Commit

Permalink
fix(switch-leader): talk to redis
Browse files Browse the repository at this point in the history
Avoid error when talking to agents
  • Loading branch information
gsanchietti committed Feb 27, 2025
1 parent e0e66c5 commit 051dd8d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions core/imageroot/usr/local/sbin/switch-leader
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,25 @@ if install_metrics and node_id == self_id:
agent.tasks.run_nowait(f'module/{traefik_id}', 'delete-route', data={
'instance': old_metrics_instance + '_prometheus'
},
endpoint="redis://cluster-leader"
)
agent.tasks.run_nowait(f'module/{traefik_id}', 'delete-route', data={
'instance': old_metrics_instance + '_grafana'
},
endpoint="redis://cluster-leader"
)

# Install prometheus and grafana on the leader node
module = "ghcr.io/nethserver/metrics:latest" # FIXME
result = agent.tasks.run("cluster", "add-module", data={
"image": module,
"node": node_id,
"check_idle_time": 0,
},
extra={
"isNotificationHidden": True,
},
endpoint="redis://cluster-leader")
"image": module,
"node": node_id,
"check_idle_time": 0,
},
extra={
"isNotificationHidden": True,
},
endpoint="redis://cluster-leader")
if result['exit_code'] != 0:
print(f"[ERROR] Failed to install {module} on the new leader node: {result['error']}", file=sys.stderr)
errors += 1
Expand Down

0 comments on commit 051dd8d

Please sign in to comment.