oracle / oci-cli

Command Line Interface for Oracle Cloud Infrastructure

Home Page:https://cloud.oracle.com/cloud-infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oci raw-request doesn't honor environment variable OCI_CLI_USE_INSTANCE_METADATA_SERVICE

w1z2g3 opened this issue · comments

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