Skip to content

e2e/qa: poll for device pubkey before running Ansible restart#3646

Merged
ben-malbeclabs merged 1 commit intomainfrom
bc/fix-provisioning-pubkey-race
May 1, 2026
Merged

e2e/qa: poll for device pubkey before running Ansible restart#3646
ben-malbeclabs merged 1 commit intomainfrom
bc/fix-provisioning-pubkey-race

Conversation

@ben-malbeclabs
Copy link
Copy Markdown
Contributor

Summary

  • Poll for the device pubkey via CLI before running Ansible restart, avoiding a race condition where the RPC hasn't propagated the new device yet
  • Without this, the Ansible task queries doublezero device list and gets null, configuring the daemon with -pubkey null

Context

Follow-up to #3641. After the provisioning test delete+recreates a device, RunAnsibleAgentRestart immediately invokes Ansible which queries the ledger for the pubkey. In testing, the RPC hadn't caught up yet — device list returned an empty array, jq produced null, and the daemon was configured with -pubkey null.

The fix polls doublezero device list --code <code> --json via SSH to the bm host until it returns the expected pubkey (up to 2 minutes, 5s intervals) before invoking Ansible.

Testing Verification

  • Confirmed the race condition exists: successful test run on 2026-05-01 left dzd4 with -pubkey null in the daemon config despite Ansible running
  • go build -tags=qa ./e2e/internal/qa/ compiles cleanly

After a delete+recreate cycle, the RPC may not have propagated the new
device yet. The Ansible restart tasks query the ledger for the pubkey
via the CLI; if the query returns null, the daemon gets configured with
-pubkey null and crashes. Poll until the CLI returns the expected pubkey
before invoking Ansible.
@ben-malbeclabs ben-malbeclabs marked this pull request as ready for review May 1, 2026 20:44
@ben-malbeclabs ben-malbeclabs merged commit 1221a05 into main May 1, 2026
34 checks passed
@ben-malbeclabs ben-malbeclabs deleted the bc/fix-provisioning-pubkey-race branch May 1, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants