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

OCI CLI Interactive - Default value for compartment-id is not working in interactive mode.

Open vamshikrishna83 opened this issue 1 year ago • 1 comments

As per https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliconfigure.htm#Specifying_Default_Values, We can store default values for options in oci_cli_rc file which works fine when we run the commands in non-interactive mode.

But, when OCI CLI is used in interactive mode, these default values are not being honored or considered - which is resulting in error Error: Missing required parameters ['--compartment-id']

For example with api-gateway.compartment-id default value specified in configuration:

  • Command oci api-gateway deployment list --lifecycle-state ACTIVE works and returns list of ACTIVE deployments in the default compartment.
  • Command oci api-gateway deployment list works fine in interactive mode, and returns list of all deployments in default compartment.
  • Command oci api-gateway deployment list --lifecycle-state ACTIVE doesn't work in interactive mode, and returns error Error: Missing required parameters ['--compartment-id']

Expected:

  • Command oci api-gateway deployment list --lifecycle-state ACTIVE should return list of all deployments in the default compartment.

vamshikrishna83 avatar Nov 13 '24 10:11 vamshikrishna83

The default breaks whenever an -- option is used. api-gateway deployment list works, but api-gateway deployment list --all does not. Same applies for other commands like compute instance list.

Airell avatar Jan 02 '25 12:01 Airell