From 2edbd002c327e1f8b9262bd0ea8381ffc28cf4c0 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 13 Mar 2019 12:36:32 +0000 Subject: [PATCH] Assure no_log is false on failed tasks 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 --- .../{{cookiecutter.scenario_name}}/create.yml | 1 + .../{{cookiecutter.scenario_name}}/create.yml | 1 + .../{{cookiecutter.scenario_name}}/create.yml | 1 + .../{{cookiecutter.scenario_name}}/create.yml | 1 + .../{{cookiecutter.scenario_name}}/create.yml | 1 + molecule/provisioner/ansible/playbooks/docker/create.yml | 7 +++++++ test/resources/playbooks/azure/create.yml | 1 + test/resources/playbooks/docker/create.yml | 1 + test/resources/playbooks/ec2/create.yml | 1 + test/resources/playbooks/gce/create.yml | 1 + test/resources/playbooks/linode/create.yml | 1 + test/resources/playbooks/openstack/create.yml | 1 + 12 files changed, 18 insertions(+) diff --git a/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index c557755bb2..73c9e64566 100644 --- a/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/azure/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -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. diff --git a/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 0554041bab..25a4b7fe3a 100644 --- a/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/ec2/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -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. diff --git a/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 5fef0d73f7..ae29c77463 100644 --- a/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/gce/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -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. diff --git a/molecule/cookiecutter/scenario/driver/linode/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/linode/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index db70913d00..8b7048b482 100644 --- a/molecule/cookiecutter/scenario/driver/linode/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/linode/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -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. diff --git a/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml index 3c3ccc7efb..84f312bdcc 100644 --- a/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ b/molecule/cookiecutter/scenario/driver/openstack/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml @@ -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. diff --git a/molecule/provisioner/ansible/playbooks/docker/create.yml b/molecule/provisioner/ansible/playbooks/docker/create.yml index ea892d93ab..af7303a284 100644 --- a/molecule/provisioner/ansible/playbooks/docker/create.yml +++ b/molecule/provisioner/ansible/playbooks/docker/create.yml @@ -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: @@ -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: @@ -47,6 +49,8 @@ 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: @@ -54,6 +58,8 @@ 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: @@ -102,3 +108,4 @@ until: docker_jobs.finished retries: 300 with_items: "{{ server.results }}" + no_log: not item.failed diff --git a/test/resources/playbooks/azure/create.yml b/test/resources/playbooks/azure/create.yml index 09a9a4f283..cf063af8a8 100644 --- a/test/resources/playbooks/azure/create.yml +++ b/test/resources/playbooks/azure/create.yml @@ -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. diff --git a/test/resources/playbooks/docker/create.yml b/test/resources/playbooks/docker/create.yml index b2bd699ba2..35aac728c1 100644 --- a/test/resources/playbooks/docker/create.yml +++ b/test/resources/playbooks/docker/create.yml @@ -102,3 +102,4 @@ until: docker_jobs.finished retries: 300 with_items: "{{ server.results }}" + no_log: not item.failed diff --git a/test/resources/playbooks/ec2/create.yml b/test/resources/playbooks/ec2/create.yml index 4ed1a0c623..04447c7895 100644 --- a/test/resources/playbooks/ec2/create.yml +++ b/test/resources/playbooks/ec2/create.yml @@ -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. diff --git a/test/resources/playbooks/gce/create.yml b/test/resources/playbooks/gce/create.yml index a9fc543881..d504cbfab3 100644 --- a/test/resources/playbooks/gce/create.yml +++ b/test/resources/playbooks/gce/create.yml @@ -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. diff --git a/test/resources/playbooks/linode/create.yml b/test/resources/playbooks/linode/create.yml index 7278f28548..8e8a601354 100644 --- a/test/resources/playbooks/linode/create.yml +++ b/test/resources/playbooks/linode/create.yml @@ -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. diff --git a/test/resources/playbooks/openstack/create.yml b/test/resources/playbooks/openstack/create.yml index 24656b7cbc..91aef1efeb 100644 --- a/test/resources/playbooks/openstack/create.yml +++ b/test/resources/playbooks/openstack/create.yml @@ -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.