Add a function for getting Rmq cluster_status info from a unit

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

View File

@@ -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)