From: Matthew Vernon Date: Wed, 19 Sep 2018 13:25:15 +0000 (+0100) Subject: restart_osd_daemon.sh.j2 - use `+` rather than `{1,}` in regex X-Git-Tag: v3.0.46~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2ab9ffafdd4a032bde9a06abb4cd3f5e3fadc536;p=ceph-ansible.git restart_osd_daemon.sh.j2 - use `+` rather than `{1,}` in regex `+` is more idiomatic for "one or more" in a regex than `{1,}`; the latter was introduced in a previous fix for an incorrect `{1,2}` restriction. Signed-off-by: Matthew Vernon (cherry picked from commit 806461ac6edd6aada39173df9d9163239fd82555) --- diff --git a/roles/ceph-defaults/templates/restart_osd_daemon.sh.j2 b/roles/ceph-defaults/templates/restart_osd_daemon.sh.j2 index b313008fb..7ffdd3616 100644 --- a/roles/ceph-defaults/templates/restart_osd_daemon.sh.j2 +++ b/roles/ceph-defaults/templates/restart_osd_daemon.sh.j2 @@ -55,7 +55,7 @@ get_docker_osd_id() { # For containerized deployments, the unit file looks like: ceph-osd@sda.service # For non-containerized deployments, the unit file looks like: ceph-osd@NNN.service where NNN is OSD ID -for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]{1,}|[a-z]+).service"); do +for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-osd@([0-9]+|[a-z]+).service"); do # First, restart daemon(s) systemctl restart "${unit}" # We need to wait because it may take some time for the socket to actually exists @@ -67,7 +67,7 @@ for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph- osd_id=$(get_docker_osd_id "$container_id") docker_exec="docker exec $container_id" {% else %} - osd_id=$(echo ${unit#ceph-osd@} | grep -oE '[0-9]{1,}') + osd_id=$(echo ${unit#ceph-osd@} | grep -oE '[0-9]+') {% endif %} SOCKET=/var/run/ceph/{{ cluster }}-osd.${osd_id}.asok while [ $COUNT -ne 0 ]; do