From 05bdfda90c48896fb7fcd21bff087ed408d863d1 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 16 Jun 2019 09:44:37 +0200 Subject: [PATCH 1/2] Remove from pylint ignore list. --- lib/ansible/modules/system/ufw.py | 4 ++-- test/sanity/pylint/ignore.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/system/ufw.py b/lib/ansible/modules/system/ufw.py index 762a1c6c513562..bba5175ffba34d 100644 --- a/lib/ansible/modules/system/ufw.py +++ b/lib/ansible/modules/system/ufw.py @@ -496,7 +496,7 @@ def ufw_version(): if relative_to_cmd == 'zero': insert_to = params['insert'] else: - (_, numbered_state, _) = module.run_command([ufw_bin, 'status', 'numbered']) + (dummy, numbered_state, dummy) = module.run_command([ufw_bin, 'status', 'numbered']) numbered_line_re = re.compile(R'^\[ *([0-9]+)\] ') lines = [(numbered_line_re.match(line), '(v6)' in line) for line in numbered_state.splitlines()] lines = [(int(matcher.group(1)), ipv6) for (matcher, ipv6) in lines if matcher] @@ -528,7 +528,7 @@ def ufw_version(): value = params[key] cmd.append([value, template % (value)]) - ufw_major, ufw_minor, _ = ufw_version() + ufw_major, ufw_minor, dummy = ufw_version() # comment is supported only in ufw version after 0.35 if (ufw_major == 0 and ufw_minor >= 35) or ufw_major > 0: cmd.append([params['comment'], "comment '%s'" % params['comment']]) diff --git a/test/sanity/pylint/ignore.txt b/test/sanity/pylint/ignore.txt index 1b170cb6790998..ab52a7e1403124 100644 --- a/test/sanity/pylint/ignore.txt +++ b/test/sanity/pylint/ignore.txt @@ -64,7 +64,6 @@ lib/ansible/modules/system/lvg.py blacklisted-name lib/ansible/modules/system/lvol.py blacklisted-name lib/ansible/modules/system/parted.py blacklisted-name lib/ansible/modules/system/timezone.py blacklisted-name -lib/ansible/modules/system/ufw.py blacklisted-name lib/ansible/modules/utilities/logic/wait_for.py blacklisted-name lib/ansible/modules/web_infrastructure/rundeck_acl_policy.py blacklisted-name lib/ansible/parsing/vault/__init__.py blacklisted-name From 40bb3ebef1863569a0a4563453113bcd7fc4631f Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 16 Jun 2019 09:45:44 +0200 Subject: [PATCH 2/2] Make sure that option is called the same as in the documentation. --- lib/ansible/modules/system/ufw.py | 6 +++--- test/sanity/validate-modules/ignore.txt | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/system/ufw.py b/lib/ansible/modules/system/ufw.py index bba5175ffba34d..573ee07e64afbe 100644 --- a/lib/ansible/modules/system/ufw.py +++ b/lib/ansible/modules/system/ufw.py @@ -321,12 +321,12 @@ def main(): to_ip=dict(type='str', default='any', aliases=['dest', 'to']), to_port=dict(type='str', aliases=['port']), proto=dict(type='str', aliases=['protocol'], choices=['ah', 'any', 'esp', 'ipv6', 'tcp', 'udp', 'gre', 'igmp']), - app=dict(type='str', aliases=['name']), + name=dict(type='str', aliases=['app']), comment=dict(type='str'), ), supports_check_mode=True, mutually_exclusive=[ - ['app', 'proto', 'logging'], + ['name', 'proto', 'logging'], ], required_one_of=([command_keys]), required_by=dict( @@ -524,7 +524,7 @@ def ufw_version(): for (key, template) in [('from_ip', "from %s"), ('from_port', "port %s"), ('to_ip', "to %s"), ('to_port', "port %s"), - ('proto', "proto %s"), ('app', "app '%s'")]: + ('proto', "proto %s"), ('name', "app '%s'")]: value = params[key] cmd.append([value, template % (value)]) diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 572eef719a3e26..bd233275f6f56f 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -3709,7 +3709,6 @@ lib/ansible/modules/system/syspatch.py E337 lib/ansible/modules/system/systemd.py E336 lib/ansible/modules/system/systemd.py E337 lib/ansible/modules/system/sysvinit.py E337 -lib/ansible/modules/system/ufw.py E337 lib/ansible/modules/system/user.py E210 lib/ansible/modules/system/user.py E324 lib/ansible/modules/system/user.py E327