one icon indicating copy to clipboard operation
one copied to clipboard

CLI tools does not report API connection error when JSON output is enabled

Open atodorov-storpool opened this issue 1 year ago • 0 comments

Description

CLI tools should have consistency in error reporting.

$ onehook list ; echo $?
Failed to open TCP connection to localhost:2633 (Connection refused - connect(2) for "localhost" port 2633)
255

$ onehook list --xml ; echo $?
Failed to open TCP connection to localhost:2633 (Connection refused - connect(2) for "localhost" port 2633)
255

$ onehook list --json ; echo $?
0

To Reproduce

  • stop the opennebula service
  • issue a cli tool with --json argument
  • no output, no error message and exit code '0'

Expected behavior An error message should be displayed and an exit code should be set

Details

  • Affected Component: [cli]
  • Hypervisor: [KVM]
  • Version: [6.4.4]

Additional context

Progress Status

  • [ ] Code committed
  • [ ] Testing - QA
  • [ ] Documentation (Release notes - resolved issues, compatibility, known issues)

atodorov-storpool avatar Feb 22 '24 10:02 atodorov-storpool