Skip to content

cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones - #1533

Merged
debarshiray merged 5 commits into
containers:mainfrom
debarshiray:wip/rishi/src-cmd-exitError
Sep 10, 2024
Merged

debarshiray merged 5 commits into
containers:mainfrom
debarshiray:wip/rishi/src-cmd-exitError

Conversation

@debarshiray

@debarshiray debarshiray commented Sep 3, 2024 •

Copy link
Copy Markdown
Member

This will make it easier to propagate the exit codes of subordinate
processes through an exitError instance, when toolbox(1) is invoked
inside a container, and invocation is forwarded to the host.

Cobra doesn't honour the root command's SilenceErrors, if an error
occurred when parsing the command line for a command, even though the
command was found. However, Cobra does honour SilenceErrors, if the
error occurred afterwards.

Therefore, to avoid setting SilenceErrors in each and every command, it
was set in the PersistentPreRunE hook (ie., preRun), which is called
after all command line parsing has been successfully completed.

#957

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 3, 2024
@debarshiray
debarshiray force-pushed the wip/rishi/src-cmd-exitError branch from 4ff621c to 17eea5f Compare September 3, 2024 14:44
@softwarefactory-delete-me

Copy link
Copy Markdown

Build failed.
https://softwarefactory-project.io/zuul/t/local/buildset/4b92cfd91992441aa73f7c6e195d43d9

❌ unit-test NODE_FAILURE Node request 200-0007562451 failed in 0s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 26s
❌ unit-test-restricted NODE_FAILURE Node request 200-0007562453 failed in 0s
❌ system-test-fedora-rawhide NODE_FAILURE Node request 200-0007562454 failed in 0s
✔️ system-test-fedora-40 SUCCESS in 1h 32m 29s
✔️ system-test-fedora-39 SUCCESS in 1h 33m 31s

@debarshiray

Copy link
Copy Markdown
Member Author

recheck

@softwarefactory-delete-me

Copy link
Copy Markdown

@debarshiray debarshiray changed the title [WIP] ... cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones Sep 4, 2024
@softwarefactory-delete-me

Copy link
Copy Markdown

It shouldn't be necessary to use the --assumeyes option when creating a
Toolbx container, if the corresponding image is already present in the
local containers/storage image store.  It's harmful to test it with the
option, even when it shouldn't be needed, because it's off by default
and most users won't enable it.

Therefore, it's better to test the most common scenario that most users
will encounter.

containers#1536
This will make it easier to propagate the exit codes of subordinate
processes through an exitError instance, when toolbox(1) is invoked
inside a container, and invocation is forwarded to the host.

Cobra doesn't honour the root command's SilenceErrors, if an error
occurred when parsing the command line for a command, even though the
command was found.  However, Cobra does honour SilenceErrors, if the
error occurred afterwards.

Therefore, to avoid setting SilenceErrors in each and every command, it
was set in the PersistentPreRunE hook (ie., preRun), which is called
after all command line parsing has been successfully completed.

containers#957
@debarshiray
debarshiray force-pushed the wip/rishi/src-cmd-exitError branch from dc88e73 to ee90bc9 Compare September 5, 2024 19:28
@softwarefactory-delete-me

Copy link
Copy Markdown

@softwarefactory-delete-me

Copy link
Copy Markdown

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