From f709c76f727dd8166851d01d205fe2159449c854 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 22 Nov 2016 11:54:25 +0100 Subject: Make os_firewall_manage_iptables run on python3 It fail with that traceback: Traceback (most recent call last): File \"/tmp/ansible_ib5gpbsp/ansible_module_os_firewall_manage_iptables.py\", line 273, in main() File \"/tmp/ansible_ib5gpbsp/ansible_module_os_firewall_manage_iptables.py\", line 257, in main iptables_manager.add_rule(port, protocol) File \"/tmp/ansible_ib5gpbsp/ansible_module_os_firewall_manage_iptables.py\", line 87, in add_rule self.verify_chain() File \"/tmp/ansible_ib5gpbsp/ansible_module_os_firewall_manage_iptables.py\", line 82, in verify_chain self.create_jump() File \"/tmp/ansible_ib5gpbsp/ansible_module_os_firewall_manage_iptables.py\", line 142, in create_jump input_rules = [s.split() for s in output.split('\\n')] --- roles/os_firewall/library/os_firewall_manage_iptables.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/os_firewall/library/os_firewall_manage_iptables.py b/roles/os_firewall/library/os_firewall_manage_iptables.py index bd638b69b..37bb16f35 100755 --- a/roles/os_firewall/library/os_firewall_manage_iptables.py +++ b/roles/os_firewall/library/os_firewall_manage_iptables.py @@ -139,7 +139,7 @@ class IpTablesManager(object): # pylint: disable=too-many-instance-attributes output = check_output(cmd, stderr=subprocess.STDOUT) # break the input rules into rows and columns - input_rules = [s.split() for s in output.split('\n')] + input_rules = [s.split() for s in to_native(output).split('\n')] # Find the last numbered rule last_rule_num = None @@ -269,5 +269,6 @@ def main(): # pylint: disable=redefined-builtin, unused-wildcard-import, wildcard-import # import module snippets from ansible.module_utils.basic import * +from ansible.module_utils._text import to_native if __name__ == '__main__': main() -- cgit v1.2.3