Save the transfer of the module file for new style modules, because we can inject the arguments into the modules.

Module consumers using the API don't have to know how this works.  base64 stuff is only there
because escaping a docstring inside a docstring was a bit of a challenge :)
This commit is contained in:
Michael DeHaan
2012-07-23 19:14:37 -04:00
parent f8520750cb
commit ec12cc4154
3 changed files with 52 additions and 46 deletions

View File

@@ -17,15 +17,15 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
try:
import json
except ImportError:
import simplejson as json
import base64
import os
import syslog
def main():
module = AnsibleModule(
argument_spec = dict()
)
module.exit_json(ping='pong')
syslog.openlog('ansible-%s' % os.path.basename(__file__))
syslog.syslog(syslog.LOG_NOTICE, 'Invoked as-is')
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main()
print json.dumps({ "ping" : "pong" })