From bc6d454b5eb844a56b18b69cbf90c85f7f44ca58 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 26 Oct 2013 11:09:30 -0400 Subject: [PATCH] Enable imports to work on a snippet based system, allowing for instance a library of common EC2 functions to be reused between modules. See library/system/service and library/system/ping for initial examples. Can work the old way to just import 'basic', or can import the new way to import multiple pieces of code from module_utils/. --- system/ping | 6 ++++-- system/service | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/system/ping b/system/ping index 69507111aec..e0ff5f2bbad 100644 --- a/system/ping +++ b/system/ping @@ -48,7 +48,9 @@ def main(): result['ping'] = module.params['data'] module.exit_json(**result) -# this is magic, see lib/ansible/module_common.py -#<> +### boilerplate: import common module snippets here +from ansible.module_utils.basic import * + +### invoke the module main() diff --git a/system/service b/system/service index fb9364c24f5..63f681f6ace 100644 --- a/system/service +++ b/system/service @@ -1205,7 +1205,11 @@ def main(): module.exit_json(**result) -# this is magic, see lib/ansible/module_common.py -#<> +### boilerplate: import common module snippets here +from ansible.module_utils.basic import * +### invoke the module main() + + +