Skip to content

fix: let --host repeat so one command reaches multiple machines - #35

Merged
abruption merged 1 commit into
mainfrom
fix/24-multi-host
Sep 8, 2026
Merged

abruption merged 1 commit into
mainfrom
fix/24-multi-host

Conversation

@abruption

Copy link
Copy Markdown
Owner

Problem

cc-peer list --host A --host B silently drops A and only talks to B — argparse keeps the last value. install.sh --host A --host B visits both. Same flag, opposite behavior.

Checking four machines requires a for-loop every time.

Fix

Change --host from the default store to action="append", default=[]. All three commands (list, send, update) now loop over hosts, catching per-host failures independently.

Design decisions

  • send --host A --host B --to worker delivers to worker on both hosts (broadcast).
  • JSON output: single --host send emits a flat object (backwards-compatible); multiple hosts emit an array. list with any --host always emits an array.
  • Exit code: 0 only if every host succeeded; 1 if any failed (remaining hosts still run).

Tests

  • test_list_iterates_over_hosts: both hosts are called
  • test_send_delivers_to_both_hosts: broadcast works
  • test_one_failure_continues: first host fails → second still runs → exit 1
  • test_single_host_send_json_is_flat: backwards-compatible JSON shape

Closes #24

argparse kept only the last --host value, silently dropping earlier
ones. install.sh already accumulated them. Now cc_peer.py uses
action="append" so --host A --host B visits both.

Each host's failure is caught and reported independently — one
unreachable machine does not prevent the others from being reached.
The exit code reflects whether any host failed.

send --host A --host B --to worker delivers to worker on both hosts
(broadcast). Single-host --json output stays a flat object for
backwards compatibility; multiple hosts emit an array.

Closes #24
@abruption
abruption merged commit 60e83c3 into main Sep 8, 2026
6 checks passed
@abruption
abruption deleted the fix/24-multi-host branch September 8, 2026 00:53
@abruption abruption mentioned this pull request Sep 8, 2026
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.

--host means something different in cc-peer than in install.sh

1 participant