tests: fixes to get regression/ running under vanilla Ansible

pull/192/head
David Wilson 7 years ago
parent b882b78d35
commit d827bdb848

@ -1,5 +1,5 @@
#!/bin/bash -ex #!/bin/bash -ex
# Run tests/ansible/integration/all.yml under Ansible and Ansible-Mitogen # Run tests/ansible/all.yml under Ansible and Ansible-Mitogen
TRAVIS_BUILD_DIR="${TRAVIS_BUILD_DIR:-`pwd`}" TRAVIS_BUILD_DIR="${TRAVIS_BUILD_DIR:-`pwd`}"
TMPDIR="/tmp/ansible-tests-$$" TMPDIR="/tmp/ansible-tests-$$"
@ -58,7 +58,7 @@ echo travis_fold:end:job_setup
echo travis_fold:start:mitogen_linear echo travis_fold:start:mitogen_linear
/usr/bin/time ./mitogen_ansible_playbook.sh \ /usr/bin/time ./mitogen_ansible_playbook.sh \
integration/all.yml \ all.yml \
-vvv \ -vvv \
-i "${TMPDIR}/hosts" -i "${TMPDIR}/hosts"
echo travis_fold:end:mitogen_linear echo travis_fold:end:mitogen_linear
@ -66,7 +66,7 @@ echo travis_fold:end:mitogen_linear
echo travis_fold:start:vanilla_ansible echo travis_fold:start:vanilla_ansible
/usr/bin/time ./run_ansible_playbook.sh \ /usr/bin/time ./run_ansible_playbook.sh \
integration/all.yml \ all.yml \
-vvv \ -vvv \
-i "${TMPDIR}/hosts" -i "${TMPDIR}/hosts"
echo travis_fold:end:vanilla_ansible echo travis_fold:end:vanilla_ansible

@ -15,6 +15,11 @@ from ansible.plugins.action import ActionBase
class ActionModule(ActionBase): class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None): def run(self, tmp=None, task_vars=None):
if not type(self._connection).__module__.startswith('ansible_mitogen'):
return {
'changed': False
}
self._connection._connect() self._connection._connect()
return { return {
'changed': True, 'changed': True,

@ -13,6 +13,7 @@ import sys
def main(): def main():
module = AnsibleModule(argument_spec={}) module = AnsibleModule(argument_spec={})
module.exit_json( module.exit_json(
argv=sys.argv,
env=dict(os.environ), env=dict(os.environ),
cwd=os.getcwd(), cwd=os.getcwd(),
python_path=sys.path, python_path=sys.path,

@ -24,7 +24,7 @@
- assert: - assert:
that: that:
- env.cwd == ansible_user_dir - env.cwd == ansible_user_dir
- env.python_path.count("") == 1 - (not env.mitogen_loaded) or (env.python_path.count("") == 1)
# Run some new-style modules that 'from ansible.module_utils...' # Run some new-style modules that 'from ansible.module_utils...'
- stat: - stat:

Loading…
Cancel
Save