Port ping to dual python3/2 compat.

This commit is contained in:
Toshio Kuratomi 2016-05-10 21:57:05 -07:00 committed by Matt Clay
parent 8ba5cc4392
commit e10b7e1773

View file

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
# #
# This file is part of Ansible # This file is part of Ansible
# #
@ -40,7 +41,7 @@ EXAMPLES = '''
ansible webservers -m ping ansible webservers -m ping
''' '''
import exceptions from ansible.module_utils.basic import AnsibleModule
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
@ -52,11 +53,10 @@ def main():
result = dict(ping='pong') result = dict(ping='pong')
if module.params['data']: if module.params['data']:
if module.params['data'] == 'crash': if module.params['data'] == 'crash':
raise exceptions.Exception("boom") raise Exception("boom")
result['ping'] = module.params['data'] result['ping'] = module.params['data']
module.exit_json(**result) module.exit_json(**result)
from ansible.module_utils.basic import * if __name__ == '__main__':
main()
main()