oracle/oci-python-sdk

oci raw-request doesn't honor environment variable OCI_CLI_USE_INSTANCE_METADATA_SERVICE

w1z2g3 opened this issue · 1 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

Sorry this issue should be filed for oci-cli instead of the sdk. Move it here: oracle/oci-cli#738