cli configuration file cannot feed `auth` variable to `oci os bucket list`
Enrivonment
- ubuntu
I have setup with a CLI configuration file oci_cli_rc with session
[DEFAULT]
compartment-id=ocid1.tenancy.oc1.....
auth=instance_principal
query=data
...
- oci cli version: 3.9.0
What I expect
running oci os bucket list
can work silently with success.
What I see
running oci os bucket list, I am prompted
ERROR: Could not find config file at /home/ubuntu/.oci/config
Do you want to create a new config file? [Y/n]:
But runing oci os bucket list --auth instance_principal successs.
An runing oci iam region list successs
What cli version are you on? (pip list | grep oci)
Are you able to run oci os ns get successfully? If not, can you share the output for oci os ns get --debug?
@mandyht Hi Mandy, thanks for your followup.
My OCI CLI version is 3.9.0
I am able to run oci os ns get successfully
@mandyht after upgrade to 3.18.1, this issue is reproducible still.
Can you confirm if your config file is indeed located at /home/ubuntu/.oci/config? Does it contain the values: user, fingerprint, key_file, tenancy, and region? If you create a new config file as prompted and execute the command again, will it still prompt you to create a new one?
Hi @mandyht Mandy, then it will be something anti-pattern. I expect the auth=instance_principal should not require me to setup any ~/.oci/config file even if it is missing. If with a config file, that is not instance_principal. but user auth.
If you didn't use --auth instance_principal, you will be using your config file for authentication. Which one did you intend to use?
@mandyht Hi Mandy, I mean the CLI configuration file should help me autofill --auth instance_principal for for CLI command. I want to use instance_principal.
And this should not be labeled as Object Storage only issue but a general CLI configuration file environment feed issue.
You won't be able to setup your oci config (config) to have your auth method applied automatically, but you may be able to setup your cli config (oci_cli_rc) so it does.
Read more about cli-specific config here: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliconfigure.htm
Hi @mandyht It is my typo in last comment. I meant CLI config. I am using the oci_cli_rc to setup. Please double check my original post.
Turns out it's currently not possible to set default auth value in cli-specific config.
You can use export OCI_CLI_AUTH=instance_principal to avoid providing the --auth option for every command.
@mandyht Yes, that is why I want this issue as labelled as enhancement issue
@davidkhala the command oci os bucket list gives error because it is not able to find namspace.If you are using oci_cli_rc file for getting the auth value then you should also specify namespace in the oci_cli_rc file(nampespace=xxx). The iam command works fine because it do not require any namspace.