-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow botocore configuration for aws modules #55217
Conversation
1e932e6
to
f06df04
Compare
f06df04
to
3f3cfcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking to close out some of the old PRs before the split happens.
The change looks good to me, any reason not ro move this one forward?
user_agent_extra='Ansible/{0}'.format(__version__), | ||
) | ||
|
||
if params.get('config') is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where's the config argument come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boto3_conn takes **params, so modules have been able to set custom configurations by doing
boto_core_config = botocore.config.Config(retries={'mode': 'adaptive', 'max_attempts': 10})
connection = boto3_conn(module, conn_type='client', resource=resource, region=region, endpoint=ec2_url, config=boto_core_config, **aws_connect_params)
The old boto config file actually supported a decent amount of customization for different services, whereas botocore/boto3 do not in ~/.aws/config. It makes sense that a module would want to define a resilient default config for the particular service. I'm not sure off the top of my head if there are still things in our codebase using it (though there have been, and easily could be 3rd party things). I don't think it's a super common use case, but the prospect of breaking something in module_utils/ec2 gives me figurative hives.
@tremble I mostly paused on it due to caution and lack of enough reviews. I'll add a changelog too. |
ci_complete
710e107
to
94200d1
Compare
I added ci_complete to the last commit to be on the safe side. I'll merge when they are passing. |
SUMMARY
WIP while still looking at a possible solution for boto modules.This PR allows UserAgent to be set for boto modules and allows general configuration for boto3 modules. Many boto configurations can be set by a boto config file like connection timeout and proxy settings. UserAgent is not able to be configured in that way. In boto3 most of those options have been removed and are only modifiable via code. This addresses both problems.
Tested with CloudTrail.
Fix #55182
ISSUE TYPE
COMPONENT NAME
AWS modules
Example use: