opensearch-cli icon indicating copy to clipboard operation
opensearch-cli copied to clipboard

[BUG] Should have non-zero exit code on failure

Open robfig opened this issue 1 year ago • 1 comments

What is the bug?

Amazon OpenSearch has many security controls, including network security configuration such as only permitting access from a VPC. In my case, an active VPN connection is required for developers to access it.

Opensearch-cli returns a 0 exit code when it fails to make the request due to lack of network access to the endpoint. It should return a non-zero exit code instead, since the execution unambiguously failed. In cases where the request was completed but a non-2xx status code was returned, it might be less clear, but a non-zero code is probably still warranted.

In this case, I wanted to detect failure to show a helpful message suggesting the developer connect to VPN if they haven't already.

robfig avatar Feb 23 '23 15:02 robfig