Skip to content

Commit

Permalink
Fix E306 in roles/etcd (kubernetes-sigs#6515)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miouge1 authored and LuckySB committed Jan 12, 2021
1 parent f92c4a8 commit 19425a1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
24 changes: 16 additions & 8 deletions roles/etcd/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- name: Configure | Check if etcd cluster is healthy # noqa 306
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
- name: Configure | Check if etcd cluster is healthy
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
args:
executable: /bin/bash
register: etcd_cluster_is_healthy
failed_when: false
changed_when: false
Expand All @@ -16,8 +18,10 @@
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"

- name: Configure | Check if etcd-events cluster is healthy # noqa 306
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
- name: Configure | Check if etcd-events cluster is healthy
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
args:
executable: /bin/bash
register: etcd_events_cluster_is_healthy
failed_when: false
changed_when: false
Expand Down Expand Up @@ -73,8 +77,10 @@
ignore_errors: "{{ etcd_events_cluster_is_healthy.rc == 0 }}"
when: is_etcd_master and etcd_events_cluster_setup

- name: Configure | Wait for etcd cluster to be healthy # noqa 306
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
- name: Configure | Wait for etcd cluster to be healthy
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
args:
executable: /bin/bash
register: etcd_cluster_is_healthy
until: etcd_cluster_is_healthy.rc == 0
retries: "{{ etcd_retries }}"
Expand All @@ -94,8 +100,10 @@
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"

- name: Configure | Wait for etcd-events cluster to be healthy # noqa 306
shell: "{{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
- name: Configure | Wait for etcd-events cluster to be healthy
shell: "set -o pipefail && {{ bin_dir }}/etcdctl endpoint --cluster status && {{ bin_dir }}/etcdctl endpoint --cluster health 2>&1 | grep -q -v 'Error: unhealthy cluster'"
args:
executable: /bin/bash
register: etcd_events_cluster_is_healthy
until: etcd_events_cluster_is_healthy.rc == 0
retries: "{{ etcd_retries }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/etcd/tasks/gen_certs_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
inventory_hostname in groups['k8s-cluster']) and
sync_certs|default(false) and inventory_hostname not in groups['etcd']

- name: Gen_certs | Copy certs on nodes # noqa 306
shell: "base64 -d <<< '{{ etcd_node_certs.stdout|quote }}' | tar xz -C {{ etcd_cert_dir }}"
- name: Gen_certs | Copy certs on nodes
shell: "set -o pipefail && base64 -d <<< '{{ etcd_node_certs.stdout|quote }}' | tar xz -C {{ etcd_cert_dir }}"
args:
executable: /bin/bash
no_log: true
Expand Down
6 changes: 4 additions & 2 deletions roles/etcd/tasks/join_etcd-events_member.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
{%- endif -%}
{%- endfor -%}
- name: Join Member | Ensure member is in etcd-events cluster # noqa 306
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}"
- name: Join Member | Ensure member is in etcd-events cluster
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_events_access_address }}"
args:
executable: /bin/bash
register: etcd_events_member_in_cluster
changed_when: false
check_mode: no
Expand Down
6 changes: 4 additions & 2 deletions roles/etcd/tasks/join_etcd_member.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
{%- endif -%}
{%- endfor -%}
- name: Join Member | Ensure member is in etcd cluster # noqa 306
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}"
- name: Join Member | Ensure member is in etcd cluster
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}"
args:
executable: /bin/bash
register: etcd_member_in_cluster
changed_when: false
check_mode: no
Expand Down

0 comments on commit 19425a1

Please sign in to comment.