From a3e4bf37962d6b8a3bd01fd49b2ff213358dcbb5 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Sat, 6 Apr 2019 02:15:31 -0400 Subject: [PATCH] check if mon daemon is installed before restarting it Signed-off-by: Rishabh Dave (cherry picked from commit 96c180cc0ea6d39555e72da5ba3ae758be1b38ba) --- roles/ceph-handler/templates/restart_mon_daemon.sh.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 b/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 index 36d50ac9f..301cb10a3 100644 --- a/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 @@ -7,6 +7,12 @@ MONITOR_NAME="{{ monitor_name }}" DOCKER_EXEC="{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}" {% endif %} +# if daemon is uninstalled, no restarting is needed; so exit with success +systemctl status ceph-mon@{{ ansible_hostname }} > /dev/null +if [[ $? -ne 0 ]]; then + exit 0 +fi + # Backward compatibility $DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok && SOCKET=/var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok $DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok && SOCKET=/var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok -- 2.39.5