diff options
author | Michael Scherer <misc@redhat.com> | 2016-10-19 00:07:28 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-10-19 08:56:40 -0700 |
commit | 647fda2648a915e548976bd49a44ccaffd1a7354 (patch) | |
tree | 3eb3b8e800f02090b63d5cdbc5d1ee94ad0ae1b3 | |
parent | 37f46879f84be592dd8989b98b21f6af107a1f2b (diff) | |
download | ansible-modules-core-647fda2648a915e548976bd49a44ccaffd1a7354.tar.gz |
Fix code for python 3
Since dict.keys return a dictkeys under python 3, we hav to cast it
to a list to avoid traceback:
Traceback (most recent call last):
File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 496, in <module>
main()
File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 490, in main
results = enforce_state(module, module.params)
File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 410, in enforce_state
parsed_new_key = parsekey(module, new_key)
File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 308, in parsekey
options = parseoptions(module, options)
File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 259, in parseoptions
options_dict[key] = value
File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 164, in __setitem__
self.itemlist.append(key)
AttributeError: 'dict_keys' object has no attribute 'append'
Yet another fix for https://github.com/ansible/ansible/pull/18053
(cherry picked from commit 6145e24ed4efb97e4e3a14d428f8cbe1712dbf5c)
-rw-r--r-- | system/authorized_key.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/system/authorized_key.py b/system/authorized_key.py index fabc7af3..f8bbbadc 100644 --- a/system/authorized_key.py +++ b/system/authorized_key.py @@ -159,7 +159,7 @@ class keydict(dict): def __init__(self, *args, **kw): super(keydict,self).__init__(*args, **kw) - self.itemlist = super(keydict,self).keys() + self.itemlist = list(super(keydict,self).keys()) def __setitem__(self, key, value): self.itemlist.append(key) super(keydict,self).__setitem__(key, value) |