From 958f824c85bf5c97ce4068ed63d976791ac3ed63 Mon Sep 17 00:00:00 2001 From: Damien Ciabrini Date: Fri, 5 Jan 2018 09:50:17 +0000 Subject: [PATCH] Fix rabbitmq-ready check for single node HA deployments The current rabbitmq-ready exec waits for rabbitmq to become clustered before it allows user creation. Unfortunately this doesn't work when the deployment contains a single node, because rabbit doesn't trigger the clustering mode at all. Set the exec test according to the number of rabbit nodes, in order to check for cluster state only when necessary. Closes-Bug: #1741345 Change-Id: I24e5e344b7f657ce5d42a7c7c45be7b5ed5e6445 Co-Authored-By: John Eckersberg (cherry picked from commit 1cfecc39dc37a01bbaea114773397c062367ae42) --- manifests/profile/pacemaker/rabbitmq_bundle.pp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/manifests/profile/pacemaker/rabbitmq_bundle.pp b/manifests/profile/pacemaker/rabbitmq_bundle.pp index 3f172eacf..d2dfdffc3 100644 --- a/manifests/profile/pacemaker/rabbitmq_bundle.pp +++ b/manifests/profile/pacemaker/rabbitmq_bundle.pp @@ -220,13 +220,19 @@ class tripleo::profile::pacemaker::rabbitmq_bundle ( before => Exec['rabbitmq-ready'], } - # This grep makes sure the rabbit app in erlang is up and running - # which is enough to guarantee that the user will eventually get - # replicated around the cluster + if size($rabbit_nodes) == 1 { + $check_command = 'rabbitmqctl status | grep -F "{rabbit,"' + } else { + # This grep makes sure the rabbit app in erlang is up and running + # which is enough to guarantee that the user will eventually get + # replicated around the cluster + $check_command = 'rabbitmqctl eval "rabbit_mnesia:is_clustered()." | grep -q true' + } + exec { 'rabbitmq-ready': path => '/usr/sbin:/usr/bin:/sbin:/bin', - command => 'rabbitmqctl eval "rabbit_mnesia:is_clustered()." | grep -q true', - unless => 'rabbitmqctl eval "rabbit_mnesia:is_clustered()." | grep -q true', + command => $check_command, + unless => $check_command, timeout => 30, tries => 180, try_sleep => 10,