Skip to content
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

bugfix. cloudwatchlogs_log_group module wrongly assumes all log group… #52513

Open
wants to merge 1 commit into
base: devel
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+8 −5
Diff settings

Always

Just for now

@@ -259,12 +259,15 @@ def main():
retention=module.params['retention'],
module=module)
elif found_log_group:
if module.params['retention'] != found_log_group['retentionInDays']:

This comment has been minimized.

Copy link
@willthames

willthames Mar 12, 2019

Contributor

A simpler fix would be

if module.params['retention'] != found_log_group.get('retentionInDays'):

wouldn't it?

I'm not at all convinced of the need to reformat the call to input_retention_policy - PEP8 does not express a preference either way: https://www.python.org/dev/peps/pep-0008/#id17.

This comment has been minimized.

Copy link
@gundalow

gundalow Mar 18, 2019

Contributor

Our coding style is "Whatever is enforced by CI"

if 'retentionInDays' in found_log_group or \
(module.params.get('retention') and 'retentionInDays' not in found_log_group):
changed = True
input_retention_policy(client=logs,
log_group_name=module.params['log_group_name'],
retention=module.params['retention'],
module=module)
input_retention_policy(
client=logs,
log_group_name=module.params['log_group_name'],
retention=module.params['retention'],
module=module
)
found_log_group['retentionInDays'] = module.params['retention']

module.exit_json(changed=changed, **camel_dict_to_snake_dict(found_log_group))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.