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

Fixup / ignore new pylint 2.9.3 issues #686

Merged
merged 4 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/686-pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- ecs_task - remove unused import (https://github.com/ansible-collections/community.aws/pull/686).
- ec2_vpc_vgw - fix arguments-renamed pylint issue (https://github.com/ansible-collections/community.aws/pull/686).
- ec2_vpc_vpn - fix arguments-renamed pylint issue (https://github.com/ansible-collections/community.aws/pull/686).
10 changes: 5 additions & 5 deletions plugins/modules/ec2_vpc_vgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ def status_code_from_exception(error):
return (error.response['Error']['Code'], error.response['Error']['Message'],)

@staticmethod
def found(response_codes, catch_extra_error_codes=None):
def found(response_code, catch_extra_error_codes=None):
retry_on = ['The maximum number of mutating objects has been reached.']

if catch_extra_error_codes:
retry_on.extend(catch_extra_error_codes)
if not isinstance(response_codes, tuple):
response_codes = (response_codes,)
if not isinstance(response_code, tuple):
response_code = (response_code,)

for code in response_codes:
if super().found(response_codes, catch_extra_error_codes):
for code in response_code:
if super().found(response_code, catch_extra_error_codes):
return True

return False
Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/ec2_vpc_vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ def status_code_from_exception(error):
return (error.response['Error']['Code'], error.response['Error']['Message'],)

@staticmethod
def found(response_codes, catch_extra_error_codes=None):
def found(response_code, catch_extra_error_codes=None):
retry_on = ['The maximum number of mutating objects has been reached.']

if catch_extra_error_codes:
retry_on.extend(catch_extra_error_codes)
if not isinstance(response_codes, tuple):
response_codes = (response_codes,)
if not isinstance(response_code, tuple):
response_code = (response_code,)

for code in response_codes:
if super().found(response_codes, catch_extra_error_codes):
for code in response_code:
if super().found(response_code, catch_extra_error_codes):
return True

return False
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ecs_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@
'''

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible.module_utils.basic import missing_required_lib
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import get_ec2_security_group_ids_from_names, ansible_dict_to_boto3_tag_list

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/sanity/ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this
6 changes: 3 additions & 3 deletions tests/sanity/ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins/modules/cloudfront_info.py pylint:unnecessary-comprehension # Should be an easy fix, but testing is a challenge - test are broken and aliases require a wildcard cert in ACM
plugins/modules/iam.py pylint:unnecessary-comprehension # iam.py is boto2 so any refactoring can get complex, also it does not have tests
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice
plugins/modules/cloudfront_info.py pylint:unnecessary-comprehension # (new test) Should be an easy fix, but testing is a challenge - test are broken and aliases require a wildcard cert in ACM
plugins/modules/iam.py pylint:unnecessary-comprehension # no tests and module is deprecated
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this
15 changes: 12 additions & 3 deletions tests/sanity/ignore-2.12.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
plugins/modules/cloudfront_info.py pylint:unnecessary-comprehension # Should be an easy fix, but testing is a challenge - test are broken and aliases require a wildcard cert in ACM
plugins/modules/iam.py pylint:unnecessary-comprehension # iam.py is boto2 so any refactoring can get complex, also it does not have tests
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice
plugins/modules/aws_kms_info.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/aws_ses_rule_set.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/cloudfront_info.py pylint:unnecessary-comprehension # (new test) Should be an easy fix, but testing is a challenge - test are broken and aliases require a wildcard cert in ACM
plugins/modules/cloudwatchevent_rule.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/elb_target_group.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/iam_group.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/iam.py pylint:use-a-generator # no tests and module is deprecated
plugins/modules/iam.py pylint:unnecessary-comprehension # no tests and module is deprecated
plugins/modules/iam_role.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/iam_user.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/rds_instance.py pylint:use-a-generator # (new test) Should be an easy fix but not worth blocking gating
plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this
10 changes: 5 additions & 5 deletions tests/unit/mock/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def load_from_file(self, path, cache=True, unsafe=False):

# TODO: the real _get_file_contents returns a bytestring, so we actually convert the
# unicode/text it's created with to utf-8
def _get_file_contents(self, path):
path = to_text(path)
if path in self._file_mapping:
return (to_bytes(self._file_mapping[path]), False)
def _get_file_contents(self, file_name):
file_name = to_text(file_name)
if file_name in self._file_mapping:
return (to_bytes(self._file_mapping[file_name]), False)
else:
raise AnsibleParserError("file not found: %s" % path)
raise AnsibleParserError("file not found: %s" % file_name)

def path_exists(self, path):
path = to_text(path)
Expand Down