Skip to content

Commit

Permalink
Assure no_log is false on failed tasks
Browse files Browse the repository at this point in the history
Improves user experience by displaying the errors that caused key
tasks to fail.

Avoids adding extra verbosity by using no_log on successes.

Fixes: #1666
Signed-off-by: Sorin Sbarnea <[email protected]>
  • Loading branch information
ssbarnea committed Mar 13, 2019
1 parent 65f6712 commit 2edbd00
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
until: azure_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed


# Mandatory configuration for Molecule to function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
until: gce_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
until: linode_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
until: os_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
7 changes: 7 additions & 0 deletions molecule/provisioner/ansible/playbooks/docker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
with_items: "{{ molecule_yml.platforms }}"
when: not item.pre_build_image | default(false)
register: platforms
no_log: platforms is success

- name: Discover local Docker images
docker_image_facts:
Expand All @@ -33,6 +34,7 @@
with_items: "{{ platforms.results }}"
when: not item.pre_build_image | default(false)
register: docker_images
no_log: docker_images is success

- name: Build an Ansible compatible image
docker_image:
Expand All @@ -47,13 +49,17 @@
when:
- platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0
- not item.item.pre_build_image | default(false)
register: result
no_log: result is success

- name: Create docker network(s)
docker_network:
name: "{{ item }}"
docker_host: "{{ item.docker_host | default(lookup('env', 'DOCKER_HOST') or 'unix://var/run/docker.sock') }}"
state: present
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}"
register: result
no_log: result is success

- name: Determine the CMD directives
set_fact:
Expand Down Expand Up @@ -102,3 +108,4 @@
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed
1 change: 1 addition & 0 deletions test/resources/playbooks/azure/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
until: azure_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed


# Mandatory configuration for Molecule to function.
Expand Down
1 change: 1 addition & 0 deletions test/resources/playbooks/docker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed
1 change: 1 addition & 0 deletions test/resources/playbooks/ec2/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
until: ec2_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
1 change: 1 addition & 0 deletions test/resources/playbooks/gce/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
until: gce_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
1 change: 1 addition & 0 deletions test/resources/playbooks/linode/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
until: linode_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down
1 change: 1 addition & 0 deletions test/resources/playbooks/openstack/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
until: os_jobs.finished
retries: 300
with_items: "{{ server.results }}"
no_log: not item.failed

# Mandatory configuration for Molecule to function.

Expand Down

0 comments on commit 2edbd00

Please sign in to comment.