Browse code

Merge "Retry rabbitmq password change"

Jenkins authored on 2014/02/01 19:50:55
Showing 1 changed files
... ...
@@ -139,12 +139,18 @@ function restart_rpc_backend() {
139 139
     if is_service_enabled rabbit; then
140 140
         # Start rabbitmq-server
141 141
         echo_summary "Starting RabbitMQ"
142
-        if is_fedora || is_suse; then
143
-            # service is not started by default
144
-            restart_service rabbitmq-server
145
-        fi
146
-        # change the rabbit password since the default is "guest"
147
-        sudo rabbitmqctl change_password guest $RABBIT_PASSWORD
142
+        # NOTE(bnemec): Retry initial rabbitmq configuration to deal with
143
+        # the fact that sometimes it fails to start properly.
144
+        # Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1059028
145
+        for i in `seq 10`; do
146
+            if is_fedora || is_suse; then
147
+                # service is not started by default
148
+                restart_service rabbitmq-server
149
+            fi
150
+            # change the rabbit password since the default is "guest"
151
+            sudo rabbitmqctl change_password guest $RABBIT_PASSWORD && break
152
+            [[ $i -eq "10" ]] && die $LINENO "Failed to set rabbitmq password"
153
+        done
148 154
         if is_service_enabled n-cell; then
149 155
             # Add partitioned access for the child cell
150 156
             if [ -z `sudo rabbitmqctl list_vhosts | grep child_cell` ]; then