Skip to content

[bug]: Silent success on empty configurations and improper context switch error propagation #929

@gcharpe1604

Description

@gcharpe1604

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

  1. Run command: harbor configurations apply -f empty-config.yaml
  2. Observe error: The CLI exits with a 0 success code without warning that nothing was applied.
  3. Try switching to an invalid context using harbor context switch.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions