Skip to content

Commit

Permalink
[sos] Support running inside Toolbx containers
Browse files Browse the repository at this point in the history
Toolbx [1] containers are Podman containers that are designed to be
used as interactive command line environments for development and
troubleshooting the host operating system.  Currently, those trying to
use them for troubleshooting with 'sos report' have been setting the
HOST environment variable inside their containers.

It will improve the user experience if sos(1) could detect that it's
running inside a Toolbx container and automatically configure itself to
do the right thing.

Toolbx containers can be distinguished from other Podman containers by
the presence of the /run/.toolboxenv file.

[1] https://containertoolbx.org/
    https://github.com/containers/toolbox

Signed-off-by: Debarshi Ray <[email protected]>
  • Loading branch information
debarshiray committed Oct 2, 2023
1 parent bee9778 commit 471e3f5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class SoS():
"""

def __init__(self, args):
if not os.getenv('HOST', None) and os.path.isfile("/run/.toolboxenv"):
os.environ['HOST'] = '/run/host'

self.cmdline = args
# define the local subcommands that exist on the system
# first import the necessary module, then add an entry to the dict that
Expand Down

0 comments on commit 471e3f5

Please sign in to comment.