Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanchietti committed Feb 25, 2025
1 parent fbfd029 commit 5216438
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/imageroot/usr/local/sbin/switch-leader
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ if install_metrics and node_id == self_id:
settings = rdb.hgetall(f'module/{module_id}/settings')
custom_alerts = rdb.hgetall(f'module/{module_id}/custom_alerts')
custom_templates = rdb.hgetall(f'module/{module_id}/custom_templates')
print(f"Migrating settings: {settings}")
print(f"Migrating custom_alerts: {custom_alerts}")
print(f"Migrating custom_templates: {custom_templates}")
module_node = rdb.hget(mkey, 'NODE_ID')
remove_tasks.append({
'agent_id': f'node/{module_node}',
Expand Down Expand Up @@ -195,9 +198,12 @@ if install_metrics and node_id == self_id:
errors += 1
else:
mid = result['output']['module_id'] # New module ID
rdb.hset(f'module/{mid}/settings', mapping=settings)
rdb.hset(f'module/{mid}/custom_alerts', custom_alerts)
rdb.hset(f'module/{mid}/custom_templates', custom_templates)
if settings:
rdb.hset(f'module/{mid}/settings', mapping=settings)
if custom_alerts:
rdb.hset(f'module/{mid}/custom_alerts', mapping=custom_alerts)
if custom_templates:
rdb.hset(f'module/{mid}/custom_templates', mapping=custom_templates)

result_config = agent.tasks.run("cluster", "restart-module", data={
"module_id": mid,
Expand Down

0 comments on commit 5216438

Please sign in to comment.