]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
restart_osd_daemon.sh.j2 - use `+` rather than `{1,}` in regex
authorMatthew Vernon <mv3@sanger.ac.uk>
Wed, 19 Sep 2018 13:25:15 +0000 (14:25 +0100)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Mon, 24 Sep 2018 12:49:21 +0000 (12:49 +0000)
`+` 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 <mv3@sanger.ac.uk>
(cherry picked from commit 806461ac6edd6aada39173df9d9163239fd82555)

roles/ceph-defaults/templates/restart_osd_daemon.sh.j2

index b313008fb572c260818ff35c2317c6ed62d2818b..7ffdd3616ecb3d7104697b6a5cc2bea64f8eb54a 100644 (file)
@@ -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