From 32923fd217cd92fd3541535ad8916f0ae261c9e8 Mon Sep 17 00:00:00 2001 From: Shengjing Zhu Date: Mon, 20 Feb 2017 16:35:56 +0800 Subject: [PATCH] fix grep match pattern for osd ids Some playbooks use [0-9]*, others use \d+$ The latter is more correct since cluster name may contain numbers. Signed-off-by: Shengjing Zhu --- infrastructure-playbooks/purge-cluster.yml | 2 +- roles/ceph-common/handlers/restart-osd.yml | 2 +- roles/ceph-common/handlers/validate-osd.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index f27925834..8bd1471eb 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -234,7 +234,7 @@ - name: stop ceph osds on ubuntu shell: | - for id in $(ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'); do + for id in $(ls /var/lib/ceph/osd/ |grep -oP '\d+$'); do initctl stop ceph-osd cluster={{ cluster }} id=$id done failed_when: false diff --git a/roles/ceph-common/handlers/restart-osd.yml b/roles/ceph-common/handlers/restart-osd.yml index dc6fbeebb..ad2fd4ffc 100644 --- a/roles/ceph-common/handlers/restart-osd.yml +++ b/roles/ceph-common/handlers/restart-osd.yml @@ -4,7 +4,7 @@ # for restarting them specifically. - name: restart ceph osds shell: | - for id in $(ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'); do + for id in $(ls /var/lib/ceph/osd/ |grep -oP '\d+$'); do systemctl restart ceph-osd@$id sleep 5 done diff --git a/roles/ceph-common/handlers/validate-osd.yml b/roles/ceph-common/handlers/validate-osd.yml index 99d1c2f87..88881212c 100644 --- a/roles/ceph-common/handlers/validate-osd.yml +++ b/roles/ceph-common/handlers/validate-osd.yml @@ -1,7 +1,7 @@ --- - name: collect osds shell: | - ls /var/lib/ceph/osd/ |grep -oh '[0-9]*' + ls /var/lib/ceph/osd/ |grep -oP '\d+$' register: osd_ids - name: wait for ceph osd socket(s)