Add sshfs mount/umount commands to SSH driver#434
Add sshfs mount/umount commands to SSH driver#434ambient-code[bot] wants to merge 5 commits intomainfrom
Conversation
…unting Implements support for mounting a remote device's filesystem locally via sshfs, enabling iterative build-install-test workflows as described in issue #322. The SSH driver CLI is restructured from a single command to a group with shell, mount, and umount subcommands. The mount command leverages the existing SSH driver infrastructure (identity files, port forwarding, direct connections) to run sshfs. Closes #322 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| def cli(self): | ||
| @driver_click_command( | ||
| self, | ||
| from jumpstarter.client.decorators import driver_click_group |
There was a problem hiding this comment.
can we make this an independent driver instead in general?
like jumpstarter-driver-ssh-mount, in this way we would avoid the clash with
j ssh mount /dev/sdb /mnt
where you want the target to execute "mount /dev/sdb /mnt"
over the time we could have other types of mounts like nfs-mount or similar, out of the scope of this PR.
There was a problem hiding this comment.
Done! I've extracted the sshfs mount/umount functionality into a completely separate driver package: jumpstarter-driver-ssh-mount.
Changes made:
- Created new package
python/packages/jumpstarter-driver-ssh-mount/with its ownSSHMountdriver andSSHMountClient - Restored the SSH driver (
jumpstarter-driver-ssh) to its original single-command form —j sshworks as before with no subcommands - The new driver registers as
j ssh-mount mount/j ssh-mount umount, avoiding the namespace clash withj ssh mount /dev/sdb /mnt - All mount/umount tests moved to the new package
- The new driver has its own
pyproject.toml, entry points, docs symlink, and example exporter config
This also leaves room for future mount-type drivers (e.g., jumpstarter-driver-nfs-mount) as independent packages.
|
@ambient-code please handle comments, create a completely separate driver. |
…-ssh-mount package Move the sshfs mount/umount functionality out of the SSH driver into its own independent driver package (jumpstarter-driver-ssh-mount). This avoids a CLI namespace clash where `j ssh mount /dev/sdb /mnt` would be ambiguous between mounting via sshfs and running `mount /dev/sdb /mnt` on the remote host over SSH. The new driver is registered as a separate CLI command (`j ssh-mount mount` / `j ssh-mount umount`), and the SSH driver is restored to its original single-command form (`j ssh`). Addresses review feedback from @mangelajo on PR #434. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| # ssh_identity_file: "/path/to/key" | ||
| children: | ||
| tcp: | ||
| type: jumpstarter_driver_network.driver.TcpNetwork |
There was a problem hiding this comment.
I think it's better to use here an SSH driver instead, in that way the ssh_identity file and other settings are already provided and we don't need to do that here as well.
There was a problem hiding this comment.
Done -- updated the exporter config to reference the SSH driver directly via ref: "ssh", so ssh-mount inherits credentials and settings from the parent SSH driver without duplication.
| @@ -0,0 +1 @@ | |||
| ../../../../../packages/jumpstarter-driver-ssh-mount/README.md No newline at end of file | |||
There was a problem hiding this comment.
you need to add this one to the driver index or docs compilation will fail.
There was a problem hiding this comment.
Done -- added ssh-mount.md to both the Utility Drivers listing and the toctree directive in the drivers index.
|
@ambient-code handle comments Also make sure sure to update the PR description as well. |
| pass | ||
| raise | ||
|
|
||
| def umount(self, mountpoint, *, lazy=False): |
There was a problem hiding this comment.
In the absence of mount point, can you envision some way to remember the mountpoints and just unmount whatever we had mounted before? (i.e. some sort of temporary session files in .jumpstarter/shell/${lease-id} or similar (i.e. a hash of the socket path...)?
There was a problem hiding this comment.
Good suggestion. Mountpoint session tracking (remembering mounts in .jumpstarter/shell/${lease-id} for argument-less unmount) adds non-trivial scope to this PR. Recommend tracking as a follow-up issue.
- Add ssh-mount.md to the driver docs toctree to fix the check-warnings
CI failure ("document isn't included in any toctree")
- Update example exporter.yaml to show ssh-mount reusing the SSH driver's
tcp child via ref instead of duplicating network config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review comment fixes pushedAddressed the following review feedback from @mangelajo: Fixed in this commit (b9d8473):
Deferred to follow-up:
PR descriptionThe PR description should be updated to reflect the current separate-driver architecture ( |
| default_username: "root" | ||
| children: | ||
| tcp: | ||
| ref: "ssh.tcp" |
There was a problem hiding this comment.
| ref: "ssh.tcp" | |
| ref: "ssh" |
Use just "ssh" as ref, and make it figure out the .tcp sub client, and grab any ssh credential info/functions from the ssh driver directly.
There was a problem hiding this comment.
Good idea -- referencing the parent SSH driver directly would eliminate the duplicate default_username config and let ssh-mount inherit credentials automatically.
However, this requires a non-trivial change to how the driver discovers its dependencies: currently SSHMount expects a tcp child directly, but with ref: "ssh" it would need to navigate into the referenced SSH driver to find its .tcp sub-client and call get_ssh_identity / get_default_username on the SSH driver exported interface rather than re-implementing those exports.
I think this is worth doing but would suggest we handle it as a follow-up PR to keep this one focused on the core sshfs mount/umount functionality. The current approach works correctly with ref: "ssh.tcp" and explicit config, and the refactoring to use ref: "ssh" would touch the driver architecture more deeply (making SSHMount a consumer of SSHWrapper interface rather than a peer).
If you would prefer it done in this PR, I can make the change -- just let me know.
There was a problem hiding this comment.
Good idea -- referencing the parent SSH driver directly would eliminate the duplicate default_username config and let ssh-mount inherit credentials automatically.
However, this requires a non-trivial change to how the driver discovers its dependencies: currently SSHMount expects a tcp child directly, but with ref ssh it would need to navigate into the referenced SSH driver to find its tcp sub-client and call get_ssh_identity / get_default_username on the SSH driver exported interface rather than re-implementing those exports.
I think this is worth doing but would suggest we handle it as a follow-up PR to keep this one focused on the core sshfs mount/umount functionality. The current approach works correctly with ref ssh.tcp and explicit config, and the refactoring to use ref ssh would touch the driver architecture more deeply (making SSHMount a consumer of SSHWrapper interface rather than a peer).
If you would prefer it done in this PR, I can make the change -- just let me know.
There was a problem hiding this comment.
I am glad to see you agree, go ahead and fix it on this PR, you can still access the ssh .tcp subchild when you just get .ssh, so you will get all (the credentials, the client functions, and the .tcp subchild)
There was a problem hiding this comment.
Done! Refactored SSHMount to use the SSH driver as its child (ref: "ssh") instead of directly accessing ssh.tcp.
Changes in commit 133978b:
- driver.py: Removed
default_username,ssh_identity,ssh_identity_fileconfig fields and the@exportmethods. SSHMount now only requires ansshchild (SSHWrapper) instead oftcp. - client.py:
identityandusernameproperties now delegate toself.ssh.identityandself.ssh.username. TCP access goes throughself.ssh.tcp. - exporter.yaml: Uses
ref: "ssh"with no duplicate config. - pyproject.toml: Added
jumpstarter-driver-sshdependency. - driver_test.py: All tests updated to use SSHWrapper as child.
- README.md: Updated config example.
Review Status SummaryComments addressed (with reactions):
Newly addressed:
CI Status:
No code changes needed at this time.The only unaddressed comment was the |
…cess SSHMount now references the SSH driver (SSHWrapper) as its 'ssh' child instead of duplicating credentials config and directly accessing 'tcp'. This eliminates duplicate default_username/ssh_identity configuration and lets ssh-mount inherit everything from the SSH driver. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| config: | ||
| host: "192.168.1.100" | ||
| port: 22 | ||
| ssh-mount: |
There was a problem hiding this comment.
| ssh-mount: | |
| mount: |
There was a problem hiding this comment.
Done in b221596 -- renamed to mount: in both the exporter config example and the README.
|
|
||
| - **Fedora/RHEL**: `sudo dnf install fuse-sshfs` | ||
| - **Debian/Ubuntu**: `sudo apt-get install sshfs` | ||
| - **macOS**: `brew install macfuse && brew install sshfs` |
There was a problem hiding this comment.
| - **macOS**: `brew install macfuse && brew install sshfs` | |
| - **macOS**: install https://macfuse.github.io/ as brew has removed sshfs support. |
There was a problem hiding this comment.
Done in b221596 -- updated to point to https://macfuse.github.io/ instead of the brew commands. Also updated the error message in client.py that shows when sshfs is not found.
Address review feedback: - Rename exporter config key from 'ssh-mount' to 'mount' for cleaner CLI - Restructure CLI from group with mount/umount subcommands to single 'mount' command with --umount flag (j mount /path, j mount --umount /path) - Fix macOS install docs: point to macfuse.github.io instead of brew - Update tests to match new CLI structure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review feedback addressed (b221596)Addressed 3 new review comments from @mangelajo:
|
Summary
jumpstarter-driver-ssh-mountpackage that providesmountandumountfunctionality for remote devices via sshfsjumpstarter-driver-ssh, avoiding CLI namespace conflicts (e.g.,j ssh mount /dev/sdb /mntvs filesystem mounting)ref: "ssh"to inherit credentials and TCP connectivity -- no duplicate configuration neededUsage
Exporter Configuration
Closes #322
Test plan
make lint-fix)🤖 Generated with Claude Code