Handle SSH access failure (exit 255) in is_dispatch_aware with actionable error#239
Draft
Handle SSH access failure (exit 255) in is_dispatch_aware with actionable error#239
Conversation
…rror message Co-authored-by: PietroPasotti <6230162+PietroPasotti@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Jhack exception if no SSH access to Juju unit
Handle SSH access failure (exit 255) in is_dispatch_aware with actionable error
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Juju 4+, SSH access is not configured by default.
is_dispatch_awarecallsjuju sshand only handled exit code1(file not found); exit code255(SSH connection failure) was re-raised as a rawCalledProcessError, producing a noisy, unhelpful traceback.Changes
jhack/helpers.py—is_dispatch_aware: CatchCalledProcessErrorwithreturncode == 255and raise aRuntimeErrorwith a clear message and step-by-step instructions to add SSH keys to Juju.Original prompt
This section details on the original issue you should resolve
<issue_title>Jhack exception if no SSH access to Juju unit (default in Juju 4+)</issue_title>
<issue_description>### Bug Description
Hi,
usage jhack on default Juju 4 deployment generates a complex trace due to lack of unit access (SSH is not configured by default).
To Reproduce