ansible_mitogen: Add regression test for ActionModuleMixin._remote_chmod()
Adapted from Jonathon's reproducer in #1087.pull/1087/head
parent
06617f8231
commit
5ab872f289
@ -0,0 +1,43 @@
|
||||
- name: regression/issue_1087__template_streamerror.yml
|
||||
# Ansible's template module has been seen to raise mitogen.core.StreamError
|
||||
# iif there is a with_items loop and the destination path has an extension.
|
||||
# This printed an error message and left file permissions incorrect,
|
||||
# but did not cause the task/playbook to fail.
|
||||
hosts: test-targets
|
||||
gather_facts: false
|
||||
become: false
|
||||
vars:
|
||||
foos:
|
||||
- dest: /tmp/foo
|
||||
- dest: /tmp/foo.txt
|
||||
foo: Foo
|
||||
bar: Bar
|
||||
tasks:
|
||||
- block:
|
||||
- name: Test template does not cause StreamError
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
environment:
|
||||
ANSIBLE_VERBOSITY: "{{ ansible_verbosity }}"
|
||||
command:
|
||||
cmd: >
|
||||
ansible-playbook
|
||||
{% for inv in ansible_inventory_sources %}
|
||||
-i "{{ inv }}"
|
||||
{% endfor %}
|
||||
regression/template_test.yml
|
||||
chdir: ../
|
||||
register: issue_1087_cmd
|
||||
failed_when:
|
||||
- issue_1087_cmd is failed
|
||||
or issue_1087_cmd.stdout is search('ERROR|mitogen\.core\.CallError')
|
||||
or issue_1087_cmd.stderr is search('ERROR|mitogen\.core\.CallError')
|
||||
|
||||
always:
|
||||
- name: Cleanup
|
||||
file:
|
||||
path: "{{ item.dest }}"
|
||||
state: absent
|
||||
with_items: "{{ foos }}"
|
||||
tags:
|
||||
- issue_1087
|
@ -0,0 +1,28 @@
|
||||
- name: regression/template_test.yml
|
||||
# Ansible's template module has been seen to raise mitogen.core.StreamError
|
||||
# iif there is a with_items loop and the destination path has an extension
|
||||
hosts: test-targets
|
||||
gather_facts: false
|
||||
become: false
|
||||
vars:
|
||||
foos:
|
||||
- dest: /tmp/foo
|
||||
- dest: /tmp/foo.txt
|
||||
foo: Foo
|
||||
bar: Bar
|
||||
tasks:
|
||||
- block:
|
||||
- name: Template files
|
||||
template:
|
||||
src: foo.bar.j2
|
||||
dest: "{{ item.dest }}"
|
||||
mode: u=rw,go=r
|
||||
# This has to be with_items, loop: doesn't trigger the bug
|
||||
with_items: "{{ foos }}"
|
||||
|
||||
always:
|
||||
- name: Cleanup
|
||||
file:
|
||||
path: "{{ item.dest }}"
|
||||
state: absent
|
||||
with_items: "{{ foos }}"
|
@ -0,0 +1 @@
|
||||
A {{ foo }} walks into a {{ bar }}. Ow!
|
Loading…
Reference in New Issue