Merge pull request #206 from dw/dmw
ansible: disable script interpreter processing for new-stylepull/209/head
commit
daffa14b6e
@ -0,0 +1,17 @@
|
||||
|
||||
- name: integration/runner__custom_python_new_style_module.yml
|
||||
hosts: all
|
||||
any_errors_fatal: true
|
||||
tasks:
|
||||
- custom_python_new_style_missing_interpreter:
|
||||
foo: true
|
||||
with_sequence: start=1 end={{end|default(1)}}
|
||||
register: out
|
||||
|
||||
- assert:
|
||||
that: |
|
||||
(not out.changed) and
|
||||
(not out.results[0].changed) and
|
||||
out.results[0].input[0].ANSIBLE_MODULE_ARGS.foo and
|
||||
out.results[0].msg == 'Here is my input'
|
||||
|
@ -0,0 +1,26 @@
|
||||
# I am an Ansible new-style Python module, but I lack an interpreter.
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
# This is the magic marker Ansible looks for:
|
||||
# from ansible.module_utils.
|
||||
|
||||
|
||||
def usage():
|
||||
sys.stderr.write('Usage: %s <input.json>\n' % (sys.argv[0],))
|
||||
sys.exit(1)
|
||||
|
||||
# Also must slurp in our own source code, to verify the encoding string was
|
||||
# added.
|
||||
with open(sys.argv[0]) as fp:
|
||||
me = fp.read()
|
||||
|
||||
input_json = sys.stdin.read()
|
||||
|
||||
print "{"
|
||||
print " \"changed\": false,"
|
||||
print " \"msg\": \"Here is my input\","
|
||||
print " \"source\": [%s]," % (json.dumps(me),)
|
||||
print " \"input\": [%s]" % (input_json,)
|
||||
print "}"
|
Loading…
Reference in New Issue