Skip to content

Next host connection - #108

Merged
cmp-202 merged 13 commits into
masterfrom
next-host-connection
Nov 15, 2026
Merged

cmp-202 merged 13 commits into
masterfrom
next-host-connection

Conversation

@cmp-202

@cmp-202 cmp-202 commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Replacing old ssh connections for tunnelling and other package improvements

- Replace the nested ssh command with real ssh2 connections opened through the parent connection's forwardOut channel. Remove server.ssh, the jump-host credential copy, and the nested prompt/command helpers.

- Track hosts as an ancestor record stack with per-record listeners and timers. Contain hop failures, advance past failed primaries, and finalize each visited host once.

- Arm the command idle timeout when a command is written, reset it on data, and cancel it when a prompt is detected. Remove the commandStartTimeout option and details.noOutput.

- Fix _sanitizeResponse for long commands whose PTY redraw places a prompt before the echoed command.

- Add host traversal and fault live tests, module target selection for src/lib/baseline, and update the README and design docs.
Remove the Hubot-era aliases and internal leaks that accumulated since the CoffeeScript version.

Breaking changes:
- Rename the host message handler from msg to onMsg.
- Remove the msg: { send } object shape.
- Remove server.hashMethod (use hostHash).
- Remove sshObj.stop (use abort).
- Remove host idleTime/dataIdleTime (use idleTimeOut/dataIdleTimeOut).

Host config no longer gains library state: defaults resolve per record,
msg.send is not rewritten into the host, and applyHostDefaults stops writing
server.hashKey.

Instance cleanup: CoffeeScript prototype defaults move into the constructor,
unused binds and dead listener helpers are removed, ssh2Client becomes the
internal _ssh2Client seam, and command/_buffer are saved and restored across a
hop so the parent resumes its own command state.

Docs: README uses onMsg, drops the removed aliases, moves internal details to
one troubleshooting note, and documents host mutation and handler this. API
baseline, close semantics, error handling, and next-host-connection notes are
updated to match.
Role settings were already read through a dynamic PROVISION_<ROLE>_<KEY> lookup, but the names never appeared literally in the script, so a search could not confirm they were used. Add a complete ROLE_ENV_KEYS contract, a --print-config mode that shows the source variable for every setting, and log the resolved sources at startup.

Also use the 4.0 host surface in the provisioning run: onMsg, onCommandComplete, and onError replace instance listeners; commandResponse handled keeps logs free of echo and prompt noise; captureStderr merges sshd/netplan errors into the response.

Make the network prefix configurable (PROVISION_<ROLE>_PREFIX, default 24) instead of hard-coding /24 and 255.255.255.0, validate port/idle/prefix values, and prefer the login password for password authentication while keeping SUDO_PASSWORD as the key-auth fallback.
The advanced logging example and credential note still used the old host msg key. Point both at onMsg/onData/onCommandComplete.

Document the new provisioning --help / --print-config modes, the configurable network prefix, and the generic PROVISION_PREFIX fallback.
Comment thread test/provision/provision.js Fixed
@cmp-202
cmp-202 merged commit abcf33e into master Nov 15, 2026
8 checks passed
@cmp-202
cmp-202 deleted the next-host-connection branch November 15, 2026 05:32
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.

2 participants