From 79996b557b9ef7cf4f5f8dd0243596fa90298842 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 27 Dec 2016 12:38:54 +0100 Subject: [PATCH] Rework ignore_errors to report no reds Signed-off-by: Bogdan Dobrelya --- roles/bootstrap-os/tasks/bootstrap-coreos.yml | 4 ++-- roles/bootstrap-os/tasks/bootstrap-ubuntu.yml | 2 +- roles/download/tasks/main.yml | 2 +- roles/download/tasks/set_docker_image_facts.yml | 2 +- roles/etcd/tasks/configure.yml | 2 +- roles/etcd/tasks/pre_upgrade.yml | 4 ++-- roles/etcd/tasks/set_cluster_health.yml | 2 +- roles/kubernetes/preinstall/tasks/set_resolv_facts.yml | 2 +- roles/network_plugin/flannel/handlers/main.yml | 2 +- scripts/collect-info.yaml | 2 +- tests/cloud_playbooks/upload-logs-gcs.yml | 4 ++-- tests/testcases/040_check-network-adv.yml | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/bootstrap-os/tasks/bootstrap-coreos.yml b/roles/bootstrap-os/tasks/bootstrap-coreos.yml index a1a21dad6..1307e0ad7 100644 --- a/roles/bootstrap-os/tasks/bootstrap-coreos.yml +++ b/roles/bootstrap-os/tasks/bootstrap-coreos.yml @@ -2,7 +2,7 @@ - name: Bootstrap | Check if bootstrap is needed raw: stat /opt/bin/.bootstrapped register: need_bootstrap - ignore_errors: True + failed_when: false tags: facts - name: Bootstrap | Run bootstrap.sh @@ -16,7 +16,7 @@ - name: Bootstrap | Check if we need to install pip shell: "{{ansible_python_interpreter}} -m pip --version" register: need_pip - ignore_errors: True + failed_when: false changed_when: false when: (need_bootstrap | failed) tags: facts diff --git a/roles/bootstrap-os/tasks/bootstrap-ubuntu.yml b/roles/bootstrap-os/tasks/bootstrap-ubuntu.yml index 19b258790..738a45c1a 100644 --- a/roles/bootstrap-os/tasks/bootstrap-ubuntu.yml +++ b/roles/bootstrap-os/tasks/bootstrap-ubuntu.yml @@ -4,7 +4,7 @@ - name: Bootstrap | Check if bootstrap is needed raw: which python register: need_bootstrap - ignore_errors: True + failed_when: false tags: facts - name: Bootstrap | Install python 2.x diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml index 8592ed223..e1859a1e6 100644 --- a/roles/download/tasks/main.yml +++ b/roles/download/tasks/main.yml @@ -53,7 +53,7 @@ raw: sh -c "mkdir -p /opt/bin; ln -sf /usr/bin/python /opt/bin/python" when: "{{ download_delegate == 'localhost' }}" delegate_to: localhost - ignore_errors: true + failed_when: false run_once: true tags: localhost diff --git a/roles/download/tasks/set_docker_image_facts.yml b/roles/download/tasks/set_docker_image_facts.yml index 7014487a5..69048c513 100644 --- a/roles/download/tasks/set_docker_image_facts.yml +++ b/roles/download/tasks/set_docker_image_facts.yml @@ -10,7 +10,7 @@ - name: Register docker images info shell: "{% raw %}/usr/bin/docker images -q | xargs /usr/bin/docker inspect -f '{{.RepoTags}},{{.RepoDigests}}'{% endraw %}" register: docker_images_raw - ignore_errors: true + failed_when: false when: not download_always_pull|bool - set_fact: docker_images="{{docker_images_raw.stdout|regex_replace('\[|\]|\\n]','')|regex_replace('\s',',')}}" diff --git a/roles/etcd/tasks/configure.yml b/roles/etcd/tasks/configure.yml index 21141c8b4..e1c07a997 100644 --- a/roles/etcd/tasks/configure.yml +++ b/roles/etcd/tasks/configure.yml @@ -2,7 +2,7 @@ - name: Configure | Check if member is in cluster shell: "{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses }} member list | grep -q {{ etcd_access_address }}" register: etcd_member_in_cluster - ignore_errors: true + failed_when: false changed_when: false when: is_etcd_master tags: facts diff --git a/roles/etcd/tasks/pre_upgrade.yml b/roles/etcd/tasks/pre_upgrade.yml index 39993b4d3..081702c4a 100644 --- a/roles/etcd/tasks/pre_upgrade.yml +++ b/roles/etcd/tasks/pre_upgrade.yml @@ -28,7 +28,7 @@ - name: "Pre-upgrade | find etcd-proxy container" command: docker ps -aq --filter "name=etcd-proxy*" register: etcd_proxy_container - ignore_errors: true + failed_when: false - name: "Pre-upgrade | remove etcd-proxy if it exists" command: "docker rm -f {{item}}" @@ -41,7 +41,7 @@ delay: 3 until: etcd_member_list.rc != 2 run_once: true - ignore_errors: true + failed_when: false - name: "Pre-upgrade | change peer names to SSL" shell: >- diff --git a/roles/etcd/tasks/set_cluster_health.yml b/roles/etcd/tasks/set_cluster_health.yml index 8ea7ae9fa..b99594c99 100644 --- a/roles/etcd/tasks/set_cluster_health.yml +++ b/roles/etcd/tasks/set_cluster_health.yml @@ -2,7 +2,7 @@ - name: Configure | Check if cluster is healthy shell: "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} cluster-health | grep -q 'cluster is healthy'" register: etcd_cluster_is_healthy - ignore_errors: true + failed_when: false changed_when: false when: is_etcd_master tags: facts diff --git a/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml b/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml index 4d0e5fa32..726cfdb53 100644 --- a/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml +++ b/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml @@ -2,7 +2,7 @@ - name: check resolvconf shell: which resolvconf register: resolvconf - ignore_errors: yes + failed_when: false changed_when: false - set_fact: diff --git a/roles/network_plugin/flannel/handlers/main.yml b/roles/network_plugin/flannel/handlers/main.yml index 8fbb7f704..0f2734264 100644 --- a/roles/network_plugin/flannel/handlers/main.yml +++ b/roles/network_plugin/flannel/handlers/main.yml @@ -1,7 +1,7 @@ --- - name: Flannel | delete default docker bridge command: ip link delete docker0 - ignore_errors: yes + failed_when: false notify: Flannel | restart docker - name: Flannel | restart docker diff --git a/scripts/collect-info.yaml b/scripts/collect-info.yaml index d0f3b9df0..570c358f3 100644 --- a/scripts/collect-info.yaml +++ b/scripts/collect-info.yaml @@ -89,7 +89,7 @@ - name: Storing commands output shell: "{{ item.cmd }} 2>&1 | tee {{ item.name }}" register: output - ignore_errors: true + failed_when: false with_items: "{{commands}}" no_log: True diff --git a/tests/cloud_playbooks/upload-logs-gcs.yml b/tests/cloud_playbooks/upload-logs-gcs.yml index 438467440..d598d6044 100644 --- a/tests/cloud_playbooks/upload-logs-gcs.yml +++ b/tests/cloud_playbooks/upload-logs-gcs.yml @@ -49,7 +49,7 @@ CLOUDSDK_CORE_DISABLE_PROMPTS: 1 CLOUDSDK_INSTALL_DIR: "{{dir}}" no_log: True - ignore_errors: true + failed_when: false - name: Apply the lifecycle rules command: "{{dir}}/google-cloud-sdk/bin/gsutil lifecycle set {{dir}}/gcs_life.json gs://{{test_name}}" @@ -68,7 +68,7 @@ gs_access_key: "{{ gs_key }}" gs_secret_key: "{{ gs_skey }}" expiration: "{{expire_days * 36000|int}}" - ignore_errors: true + failed_when: false no_log: True - debug: diff --git a/tests/testcases/040_check-network-adv.yml b/tests/testcases/040_check-network-adv.yml index e0cd73990..1e2540cb9 100644 --- a/tests/testcases/040_check-network-adv.yml +++ b/tests/testcases/040_check-network-adv.yml @@ -49,7 +49,7 @@ until: "{{ agents.content|length > 0 and agents.content[0] == '{' and agents.content|from_json|length >= groups['kube-node']|length * 2 }}" - ignore_errors: true + failed_when: false no_log: true - debug: var=agents.content|from_json @@ -65,7 +65,7 @@ retries: 3 delay: "{{ agent_report_interval }}" no_log: true - ignore_errors: true + failed_when: false when: not agents.content=='{}' - debug: var=result.content|from_json