Skip to content

Commit

Permalink
Progress /testing
Browse files Browse the repository at this point in the history
  • Loading branch information
aemous committed Oct 16, 2024
1 parent 0904ffe commit f11eb3d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions awscli/botocore/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions awscli/botocore/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions awscli/botocore/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
23 changes: 16 additions & 7 deletions awscli/clidriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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',
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f11eb3d

Please sign in to comment.