Skip to content

Fix issue #2184: Enable Ptyxis to use toolbox(1) to enter containers#1785

Open
cschalle wants to merge 5 commits intocontainers:mainfrom
cschalle:fix-issue-2184
Open

Fix issue #2184: Enable Ptyxis to use toolbox(1) to enter containers#1785
cschalle wants to merge 5 commits intocontainers:mainfrom
cschalle:fix-issue-2184

Conversation

@cschalle
Copy link
Copy Markdown

Fixes #2184

Summary

Added --env, --use-fallback-shell, and --workdir flags to toolbox run command

Added three new options to the toolbox run command to enable Ptyxis to use toolbox(1) instead of directly invoking podman exec:

  1. --env KEY=VALUE: Repeatable flag to pass environment variables into the container exec session. Uses StringArrayVar to avoid splitting on commas.

  2. --use-fallback-shell: Boolean flag that enables fallback-to-bash behavior (trying /bin/bash -l, then /bin/sh -l) when the specified command is not found. Also added /bin/sh -l as a second entry in runFallbackCommands.

  3. --workdir DIR: String flag to override the working directory used inside the container. Validates that the value is an absolute path.

Files modified:

  • src/cmd/run.go: Added fields to runFlags struct, registered new flags, added workdir validation, updated runCommand signature with extraEnviron parameter, appended extra environ vars.
  • src/cmd/enter.go: Updated runCommand call to pass nil for the new extraEnviron parameter.
  • doc/toolbox-run.1.md: Added documentation for all three new options in SYNOPSIS and OPTIONS sections.
  • test/system/104-run.bats: Added 5 test cases covering --env, multiple --env, --workdir, invalid --workdir, and --use-fallback-shell.
  • NEWS: Added 0.4 section documenting the three new enhancements.

References

Test Results

  • Build: Pass
  • Tests: Pass

Generated using Claude AI by Maintainer Buddy

@cschalle cschalle requested a review from debarshiray as a code owner April 23, 2026 18:29
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the 'toolbox run' command by adding the '--env', '--workdir', and '--use-fallback-shell' options. These additions allow users to set environment variables, specify an absolute working directory, and fall back to standard shells if a command is missing within the container. The PR includes necessary updates to the man pages, command logic, and system tests. I have no feedback to provide.

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.

1 participant