From 47657d6113a2686323aec00c97970632c25be13f Mon Sep 17 00:00:00 2001 From: Edin Sarajlic Date: Thu, 19 Sep 2019 14:12:10 +1000 Subject: [PATCH] Add a function for getting Rmq cluster_status info from a unit --- .../openstack/charm_tests/rabbitmq_server/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zaza/openstack/charm_tests/rabbitmq_server/utils.py b/zaza/openstack/charm_tests/rabbitmq_server/utils.py index 7599511..3ef9836 100644 --- a/zaza/openstack/charm_tests/rabbitmq_server/utils.py +++ b/zaza/openstack/charm_tests/rabbitmq_server/utils.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging import zaza.model @@ -31,3 +32,16 @@ def wait_for_cluster(model_name=None, timeout=1200): timeout=timeout) +def get_cluster_status(unit): + """Execute rabbitmq cluster status command on a unit and return + the full output. + :param unit: unit + :returns: String containing console output of cluster status command + """ + cmd = 'rabbitmqctl cluster_status' + output = zaza.model.run_on_unit(unit.entity_id, cmd)['Stdout'].strip() + logging.debug('{} cluster_status:\n{}'.format( + unit.entity_id, output)) + return str(output) + +