Skip to content

feat(mock): mock cuems-nodeconf answers node adoption without discovery - #39

Open
ibiltari wants to merge 1 commit into
rc_1from
feat/mock-nodeconf
Open

ibiltari wants to merge 1 commit into
rc_1from
feat/mock-nodeconf

Conversation

@ibiltari

Copy link
Copy Markdown
Member

ClickUp: 869fhghhe · Packaging: debian/mock-nodeconf-dropin (PR against debian/bookworm)

Problem

On mock boxes (dev.stagelab.coop) cuems-nodeconf is stubbed out (ExecStart=/bin/true). The real daemon would rewrite network_map.xml from whatever avahi hears on the LAN, and on a public VPS that would wipe the box's invented nodes. So the engine refused every adopt/unadopt from the UI with "cuems-nodeconf is not running", and the node adoption UI (#32) could not be exercised there.

Change (mock script only)

New scripts/mock_nodeconf.py, run as python3 -m cuemsengine.scripts.mock_nodeconf [--map PATH]:

  • Serves /tmp/nodeconf.ipc (NNG Rep, mode 0666) like cuems-nodeconf, and answers every request.
  • nodelist_modify ADD/REMOVE flips <adopted> in network_map.xml. Same rules as nodeconf: an offline node cannot be adopted, the master cannot be unadopted, an unknown uuid is an error, and "already (un)adopted" is OK.
  • The rewrite is validated against the network_map.xsd the engine reads with, then renamed atomically over the file. Other fields are kept verbatim.
  • No discovery at all: the nodes the box lists stay as they are.
  • Removes the socket on exit, so the engine refuses at once instead of waiting its 15 s IPC timeout.

Test plan

  • black, isort, flake8
  • local: the 7 request cases against a copy of dev's network_map.xml; ADD+REMOVE leaves the nodes block identical
  • dev.stagelab.coop through apache /ws, as the settings page sends it: ADD → OK + <adopted>True, ADD again → OK, REMOVE → OK + <adopted>False, REMOVE master → "Cannot unadopt master node"; the engine logs "network_map reloaded after a node list change"; load/GO/STOP unaffected

On mock boxes cuems-nodeconf is stubbed out (the real daemon would rewrite
network_map.xml from avahi on a public VPS), so the engine refused every
adopt/unadopt from the UI with "cuems-nodeconf is not running".

mock_nodeconf serves /tmp/nodeconf.ipc like cuems-nodeconf and handles
nodelist_modify by flipping <adopted> in network_map.xml: same rules (an
offline node cannot be adopted, the master cannot be unadopted, unknown uuid
is an error), validated against the network_map.xsd the engine reads with,
written atomically. No discovery: the nodes the box lists stay as they are.
Run it as `python3 -m cuemsengine.scripts.mock_nodeconf [--map PATH]`.
@ibiltari
ibiltari requested a review from backenv as a code owner October 15, 2026 18:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant