Skip to content

Commit

Permalink
Inhibit automated updates during NS7 migration (#737)
Browse files Browse the repository at this point in the history
Skip the nightly apply-updates process if a NS7 node is part of the
cluster to prevent unintended updates during migration.

Refs NethServer/dev#7070
  • Loading branch information
DavidePrincipi authored Oct 22, 2024
1 parent 2f59fe7 commit 4a00569
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/imageroot/var/lib/nethserver/cluster/bin/apply-updates
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ import os
import sys

rdb = agent.redis_connect()
# Find cluster nodes from the index key

# Inhibit automated updates if a NS7 node has joined the cluster. During
# NS7 migration, an NS7 node has the "nomodules" flag, indicating no NS8
# modules.
for kflags in rdb.keys('node/*/flags'):
if bool(rdb.sismember(kflags, 'nomodules')):
node_id = kflags.removesuffix('/flags')
print(agent.SD_NOTICE + f"Skipping updates: NS7 {node_id} is part of the cluster.", file=sys.stderr)
sys.exit(0)

# Find cluster nodes from the index key. Any NS8 node has at least a
# Traefik module.
nodes = list(int(node_id) for node_id in set(rdb.hvals("cluster/module_node")))
terrors = agent.tasks.runp_brief(list({
"agent_id": f'node/{node_id}',
Expand Down

0 comments on commit 4a00569

Please sign in to comment.