Description
Currently, when a user applies an empty or invalid configuration file using the CLI, the operation exits silently as a "success" instead of alerting the user. Additionally, failures during context switching print to stdout but do not return proper exit codes, which breaks automation and scripting workflows.
Steps to Reproduce
- Run command:
harbor configurations apply -f empty-config.yaml
- Observe error: The CLI exits with a
0 success code without warning that nothing was applied.
- Try switching to an invalid context using
harbor context switch.
- Observe error: The CLI prints a failure message but still exits with a
0 code.
Expected Behavior
The CLI should return an explicit error and exit with a non-zero exit code (1) when configuration files are completely empty/nil or when context switching fails.
Actual Behavior
The CLI exits gracefully (0) making it seem like the operations succeeded.
Environment
- OS: All
- Tool version: Latest main
- Other relevant details: Affects
cmd/harbor/root/configurations/apply.go and cmd/harbor/root/context/switch.go.
Description
Currently, when a user applies an empty or invalid configuration file using the CLI, the operation exits silently as a "success" instead of alerting the user. Additionally, failures during context switching print to
stdoutbut do not return proper exit codes, which breaks automation and scripting workflows.Steps to Reproduce
harbor configurations apply -f empty-config.yaml0success code without warning that nothing was applied.harbor context switch.0code.Expected Behavior
The CLI should return an explicit error and exit with a non-zero exit code (
1) when configuration files are completely empty/nil or when context switching fails.Actual Behavior
The CLI exits gracefully (
0) making it seem like the operations succeeded.Environment
cmd/harbor/root/configurations/apply.goandcmd/harbor/root/context/switch.go.