From 75c281debc2b29399ecd14e1dfc4898460811e24 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 6 Dec 2016 18:00:35 -0500 Subject: [PATCH] Fix compile errors in scripts. --- contrib/inventory/vagrant.py | 4 ++-- examples/scripts/uptime.py | 12 ++++++------ hacking/dump_playbook_attributes.py | 2 +- test/compile/python2.4-skip.txt | 1 - test/compile/python2.6-skip.txt | 2 -- test/compile/python3.5-skip.txt | 1 - 6 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 test/compile/python2.6-skip.txt delete mode 100644 test/compile/python3.5-skip.txt diff --git a/contrib/inventory/vagrant.py b/contrib/inventory/vagrant.py index e7ba0dbe58..37a6741b09 100755 --- a/contrib/inventory/vagrant.py +++ b/contrib/inventory/vagrant.py @@ -69,7 +69,7 @@ parser.add_option('--host', default=None, dest="host", # get all the ssh configs for all boxes in an array of dictionaries. def get_ssh_config(): - return {k: get_a_ssh_config(k) for k in list_running_boxes()} + return dict((k, get_a_ssh_config(k)) for k in list_running_boxes()) # list all the running boxes @@ -102,7 +102,7 @@ def get_a_ssh_config(box_name): if os.path.isfile(id): host_config['identityfile'] = id - return {v: host_config[k] for k, v in _ssh_to_ansible} + return dict((v, host_config[k]) for k, v in _ssh_to_ansible) # List out servers that vagrant has running # ------------------------------ diff --git a/examples/scripts/uptime.py b/examples/scripts/uptime.py index 3ea6725b75..6357d5a75e 100755 --- a/examples/scripts/uptime.py +++ b/examples/scripts/uptime.py @@ -72,17 +72,17 @@ def main(): if tqm is not None: tqm.cleanup() - print "UP ***********" + print("UP ***********") for host, result in callback.host_ok.items(): - print '{} >>> {}'.format(host, result._result['stdout']) + print('{} >>> {}'.format(host, result._result['stdout'])) - print "FAILED *******" + print("FAILED *******") for host, result in callback.host_failed.items(): - print '{} >>> {}'.format(host, result._result['msg']) + print('{} >>> {}'.format(host, result._result['msg'])) - print "DOWN *********" + print("DOWN *********") for host, result in callback.host_unreachable.items(): - print '{} >>> {}'.format(host, result._result['msg']) + print('{} >>> {}'.format(host, result._result['msg'])) if __name__ == '__main__': main() diff --git a/hacking/dump_playbook_attributes.py b/hacking/dump_playbook_attributes.py index 357fbfaec2..c1efb9c162 100755 --- a/hacking/dump_playbook_attributes.py +++ b/hacking/dump_playbook_attributes.py @@ -29,7 +29,7 @@ for aclass in class_list: # build ordered list to loop over and dict with attributes clist.append(name) - oblist[name] = {x: aobj.__dict__['_attributes'][x] for x in aobj.__dict__['_attributes'] if 'private' not in x or not x.private} + oblist[name] = dict((x, aobj.__dict__['_attributes'][x]) for x in aobj.__dict__['_attributes'] if 'private' not in x or not x.private) # loop is really with_ for users if name == 'Task': diff --git a/test/compile/python2.4-skip.txt b/test/compile/python2.4-skip.txt index dc7fb631ff..2a3a41ca45 100644 --- a/test/compile/python2.4-skip.txt +++ b/test/compile/python2.4-skip.txt @@ -26,7 +26,6 @@ /lib/ansible/modules/remote_management/ipmi/ /lib/ansible/modules/univention/ /lib/ansible/modules/web_infrastructure/letsencrypt.py -/lib/ansible/modules/__init__.py /lib/ansible/module_utils/a10.py /lib/ansible/module_utils/azure_rm_common.py /lib/ansible/module_utils/cloud.py diff --git a/test/compile/python2.6-skip.txt b/test/compile/python2.6-skip.txt deleted file mode 100644 index 4637820e9d..0000000000 --- a/test/compile/python2.6-skip.txt +++ /dev/null @@ -1,2 +0,0 @@ -/contrib/inventory/vagrant.py -/hacking/dump_playbook_attributes.py diff --git a/test/compile/python3.5-skip.txt b/test/compile/python3.5-skip.txt deleted file mode 100644 index 1f7eb64c2d..0000000000 --- a/test/compile/python3.5-skip.txt +++ /dev/null @@ -1 +0,0 @@ -/examples/scripts/uptime.py