oracle / oracle/oci-cli

oci raw-request doesn't honor environment variable OCI_CLI_USE_INSTANCE_METADATA_SERVICE

Open
#738 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
669
Forks
236
Avg merge
1m
Merged PRs (30d)
4

Description

Is this design on purpose? If not, a potential untested fix:

diff --git a/src/oci_cli/cli_util.py b/src/oci_cli/cli_util.py
index 1356358b..87f6f8c1 100644
--- a/src/oci_cli/cli_util.py
+++ b/src/oci_cli/cli_util.py
@@ -466,6 +466,10 @@ def set_request_session_properties_from_context(session, ctx, uses_ssl=True):


 def build_raw_requests_session(ctx):
+
+    if 'OCI_CLI_USE_INSTANCE_METADATA_SERVICE' in os.environ:
+        oci.regions.enable_instance_metadata_service()
+
     config_and_signer = create_config_and_signer_based_on_click_context(ctx)
     signer = config_and_signer.signer
     client_config = config_and_signer.config

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/oci_cli/cli_util.py at build_raw_requests_session and read how the raw-request session is built from the Click context and environment. Check whether OCI_CLI_USE_INSTANCE_METADATA_SERVICE is honored there, then verify the behavior with the existing raw-request coverage or a focused test; done means the raw-request command consistently respects that environment variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.