Add function that waits until Rmq units are clustered and ready

This commit is contained in:
Edin Sarajlic
2019-09-19 14:09:09 +10:00
parent cf91a9dab9
commit 2fb7dcbdfc

View File

@@ -11,3 +11,23 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import zaza.model
def wait_for_cluster(model_name=None, timeout=1200):
"""Wait for rmq units extended status to show cluster readiness,
after an optional initial sleep period. Initial sleep is likely
necessary to be effective following a config change, as status
message may not instantly update to non-ready."""
states = {
'rabbitmq-server': {
'workload-status-messages': 'Unit is ready and clustered'
}
}
zaza.model.wait_for_application_states(model_name=model_name,
states=states,
timeout=timeout)