Skip to content

Commit

Permalink
bugfix: fix grep command without -w option causing prefix matched whi…
Browse files Browse the repository at this point in the history
…le adding one etcd member (#10291)
  • Loading branch information
yangsenzk authored Jul 14, 2023
1 parent 38ce02c commit 13aa322
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions roles/etcd/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
ETCDCTL_ENDPOINTS: "{{ etcd_events_access_addresses }}"

- name: Configure | Check if member is in etcd cluster
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}"
shell: "{{ bin_dir }}/etcdctl member list | grep -w -q {{ etcd_access_address }}"
register: etcd_member_in_cluster
ignore_errors: true # noqa ignore-errors
changed_when: false
Expand All @@ -146,7 +146,7 @@
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"

- name: Configure | Check if member is in etcd-events cluster
shell: "{{ bin_dir }}/etcdctl member list | grep -q {{ etcd_access_address }}"
shell: "{{ bin_dir }}/etcdctl member list | grep -w -q {{ etcd_access_address }}"
register: etcd_events_member_in_cluster
ignore_errors: true # noqa ignore-errors
changed_when: false
Expand Down
2 changes: 1 addition & 1 deletion roles/etcd/tasks/join_etcd-events_member.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{%- endfor -%}
- name: Join Member | Ensure member is in etcd-events cluster
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep {{ etcd_events_access_address }} >/dev/null"
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -w {{ etcd_events_access_address }} >/dev/null"
args:
executable: /bin/bash
register: etcd_events_member_in_cluster
Expand Down
2 changes: 1 addition & 1 deletion roles/etcd/tasks/join_etcd_member.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{%- endfor -%}
- name: Join Member | Ensure member is in etcd cluster
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep {{ etcd_access_address }} >/dev/null"
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep -w {{ etcd_access_address }} >/dev/null"
args:
executable: /bin/bash
register: etcd_member_in_cluster
Expand Down

0 comments on commit 13aa322

Please sign in to comment.