Skip to content

govc ls /testDC/host/dummyCluster returns success code when path is absent #3874

@mdshoaib707

Description

@mdshoaib707

Describe the bug
When govc ls is run against a non-existent vSphere path like /testDC/host/dummyCluster, it yields an exit code of 0. This is incorrect; a non-zero exit code is expected for non-existent resources.
For example, when I use govc ls /testDC/host/dummyCluster , in any case the exit code is 0 even if the cluster doesn't exist. Considering cluster1 exists but any other name dummyCluster doesn't exist and we still get an exit code 0 which shouldn't be the case.

To Reproduce
Steps to reproduce the behavior:

  1. govc ls /testDC/host/cluster1
  2. echo $?
  3. govc ls /testDC/host/dummyCluster
  4. echo $?

Expected behavior
A clear and concise description of what you expected to happen.
govc ls /testDC/host/cluster1 should give proper exit code and non-zero if the cluster doesn't exist.

Affected version
Please provide details on the version used, e.g. release tag, commit, module version, etc.

Screenshots/Debug Output
If applicable, add screenshots or debug output to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions