Merge pull request #1055 from mattymo/etcd-preupgrade-speedup

speed up etcd preupgrade check
This commit is contained in:
Matthew Mosesohn 2017-02-21 12:51:42 +03:00 committed by GitHub
commit d4f15ab402

View file

@ -34,6 +34,11 @@
command: "{{ docker_bin_dir }}/docker rm -f {{item}}" command: "{{ docker_bin_dir }}/docker rm -f {{item}}"
with_items: "{{etcd_proxy_container.stdout_lines}}" with_items: "{{etcd_proxy_container.stdout_lines}}"
- name: "Pre-upgrade | see if etcdctl is installed"
stat:
path: "{{ bin_dir }}/etcdctl"
register: etcdctl_installed
- name: "Pre-upgrade | check if member list is non-SSL" - name: "Pre-upgrade | check if member list is non-SSL"
command: "{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list" command: "{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list"
register: etcd_member_list register: etcd_member_list
@ -41,6 +46,7 @@
delay: 3 delay: 3
until: etcd_member_list.rc != 2 until: etcd_member_list.rc != 2
run_once: true run_once: true
when: etcdctl_installed.stat.exists
failed_when: false failed_when: false
- name: "Pre-upgrade | change peer names to SSL" - name: "Pre-upgrade | change peer names to SSL"
@ -48,4 +54,4 @@
{{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list | {{ bin_dir }}/etcdctl --no-sync --peers={{ etcd_access_addresses | regex_replace('https','http') }} member list |
awk -F"[: =]" '{print "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses | regex_replace('https','http') }} member update "$1" https:"$7":"$8}' | bash awk -F"[: =]" '{print "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses | regex_replace('https','http') }} member update "$1" https:"$7":"$8}' | bash
run_once: true run_once: true
when: 'etcd_member_list.rc == 0 and "http://" in etcd_member_list.stdout' when: 'etcdctl_installed.stat.exists and etcd_member_list.rc == 0 and "http://" in etcd_member_list.stdout'