From f11eb3d8b2fbaa6a860a4e981e2008ab798826cc Mon Sep 17 00:00:00 2001 From: aemous Date: Tue, 15 Oct 2024 11:50:26 -0400 Subject: [PATCH] Progress /testing --- awscli/botocore/args.py | 1 + awscli/botocore/handlers.py | 1 + awscli/botocore/session.py | 5 +++++ awscli/clidriver.py | 23 ++++++++++++++++------- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/awscli/botocore/args.py b/awscli/botocore/args.py index d2ec4b63adf9..44f135279b2d 100644 --- a/awscli/botocore/args.py +++ b/awscli/botocore/args.py @@ -148,6 +148,7 @@ def compute_client_args(self, service_model, client_config, endpoint_bridge, region_name, endpoint_url, is_secure, scoped_config): service_name = service_model.endpoint_prefix + logger.debug(f'CLI ARGS.PY: {client_config.sigv4a_signing_region_set}') protocol = service_model.metadata['protocol'] parameter_validation = True if client_config and not client_config.parameter_validation: diff --git a/awscli/botocore/handlers.py b/awscli/botocore/handlers.py index 7084feb8c368..272be72be3a7 100644 --- a/awscli/botocore/handlers.py +++ b/awscli/botocore/handlers.py @@ -168,6 +168,7 @@ def set_operation_specific_signer(context, signing_name, **kwargs): authenticated at all, but can include other auth modes such as sigv4 without body signing. """ + logger.debug(f'context: {context}') auth_type = context.get('auth_type') # Auth type will be None if the operation doesn't have a configured auth diff --git a/awscli/botocore/session.py b/awscli/botocore/session.py index 0f87a7376582..869f0a2ccc11 100644 --- a/awscli/botocore/session.py +++ b/awscli/botocore/session.py @@ -377,6 +377,7 @@ def full_config(self): :rtype: dict """ if self._config is None: + print(f'self._config IS NONE!') try: config_file = self.get_config_variable('config_file') self._config = botocore.configloader.load_config(config_file) @@ -813,6 +814,7 @@ def create_client(self, service_name, region_name=None, """ default_client_config = self.get_default_client_config() + print(f'DEFAULT CONFIG: {default_client_config.sigv4a_signing_region_set}') # If a config is provided and a default config is set, then # use the config resulting from merging the two. if config is not None and default_client_config is not None: @@ -824,6 +826,8 @@ def create_client(self, service_name, region_name=None, region_name = self._resolve_region_name(region_name, config) + print(f'SESSION CREATE CLIENT: {config.sigv4a_signing_region_set}') + # Figure out the verify value base on the various # configuration options. if verify is None: @@ -870,6 +874,7 @@ def create_client(self, service_name, region_name=None, loader, endpoint_resolver, self.user_agent(), event_emitter, response_parser_factory, exceptions_factory, config_store, user_agent_creator=user_agent_creator) + print(f'scoped config: {self.get_scoped_config()}') client = client_creator.create_client( service_name=service_name, region_name=region_name, is_secure=use_ssl, endpoint_url=endpoint_url, verify=verify, diff --git a/awscli/clidriver.py b/awscli/clidriver.py index 50eabc6c9e3a..efdb35a18c71 100644 --- a/awscli/clidriver.py +++ b/awscli/clidriver.py @@ -98,6 +98,8 @@ def create_clidriver(args=None): args, _ = parser.parse_known_args(args) debug = args.debug session = botocore.session.Session() + print(f'ENV VAR: {os.environ["AWS_SIGV4A_SIGNING_REGION_SET"]}') + print(f'CLIDRIVER FULL CONFIG: {session.full_config}') _set_user_agent_for_session(session) load_plugins(session.full_config.get('plugins', {}), event_hooks=session.get_component('event_emitter')) @@ -243,7 +245,6 @@ def __init__(self, session=None, error_handler=None, self.alias_loader = AliasLoader() def _update_config_chain(self): - print('config chain updated') config_store = self.session.get_component('config_store') config_store.set_config_provider( 'region', @@ -265,18 +266,24 @@ def _update_config_chain(self): 'cli_auto_prompt', self._construct_cli_auto_prompt_chain() ) - config_store.set_config_provider( 'sigv4a_signing_region_set', - ChainProvider(providers=[EnvironmentProvider( + ChainProvider(providers=[ + InstanceVarProvider( + instance_var='sigv4a_signing_region_set', + session=self.session + ), + EnvironmentProvider( name='AWS_SIGV4A_SIGNING_REGION_SET', env=os.environ, - )]) + ), + ScopedConfigProvider( + config_var_name='sigv4a_signing_region_set', + session=self.session, + ) + ]) ) - self.session.set_config_variable('sigv4a_signing_region_set', 'us-west-2,us-east-1') - print(self.session.get_config_variable('sigv4a_signing_region_set')) - def _construct_cli_region_chain(self): providers = [ InstanceVarProvider( @@ -968,6 +975,8 @@ def invoke(self, service_name, operation_name, parameters, parsed_globals): value is returned. """ + print('CLIDRIVER: ABOUT TO CREATE CLIENT') + print(f'full config: {self._session.full_config}') client = self._session.create_client( service_name, region_name=parsed_globals.region, endpoint_url=parsed_globals.endpoint_url,