From 9ecd22068348e14b4b87372d5e1079ef2e4b32fa Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 18 Oct 2016 07:54:59 +0200 Subject: [PATCH] Make the code run on python 3 Test suite block on: Traceback (most recent call last): File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 496, in main() File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 490, in main results = enforce_state(module, module.params) File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 410, in enforce_state parsed_new_key = parsekey(module, new_key) File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 308, in parsekey options = parseoptions(module, options) File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 253, in parseoptions if options_dict.has_key(key): AttributeError: 'keydict' object has no attribute 'has_key' With keydict being a subclass of dict. --- lib/ansible/modules/system/authorized_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/authorized_key.py b/lib/ansible/modules/system/authorized_key.py index 09e4bf30231..3435cfc9d3c 100644 --- a/lib/ansible/modules/system/authorized_key.py +++ b/lib/ansible/modules/system/authorized_key.py @@ -250,7 +250,7 @@ def parseoptions(module, options): for part in parts: if "=" in part: (key, value) = part.split("=", 1) - if options_dict.has_key(key): + if key in options_dict: if isinstance(options_dict[key], list): options_dict[key].append(value) else: