Set universal_newlines=True when calling rabbitmqctl cluster_status
In python3 check_output() returns bytes, while python2 returns str, passing universal_newlines=True assures it will return str no matter what python version is used. Change-Id: I34a490bc4142e78d725ad0973607587984ec7c49 Related-Bug: 1716981
This commit is contained in:
parent
69cc374d11
commit
058bac0515
|
@ -52,7 +52,8 @@ def resume(args):
|
|||
def cluster_status(args):
|
||||
"""Return the output of 'rabbitmqctl cluster_status'."""
|
||||
try:
|
||||
clusterstat = check_output(['rabbitmqctl', 'cluster_status'])
|
||||
clusterstat = check_output(['rabbitmqctl', 'cluster_status'],
|
||||
universal_newlines=True)
|
||||
action_set({'output': clusterstat})
|
||||
except CalledProcessError as e:
|
||||
action_set({'output': e.output})
|
||||
|
|
|
@ -62,7 +62,8 @@ class ClusterStatusTestCase(CharmTestCase):
|
|||
self.check_output.return_value = 'Cluster status OK'
|
||||
actions.cluster_status([])
|
||||
self.check_output.assert_called_once_with(['rabbitmqctl',
|
||||
'cluster_status'])
|
||||
'cluster_status'],
|
||||
universal_newlines=True)
|
||||
self.action_set.assert_called()
|
||||
|
||||
def test_cluster_status_execption(self):
|
||||
|
@ -70,7 +71,8 @@ class ClusterStatusTestCase(CharmTestCase):
|
|||
"Failure")
|
||||
actions.cluster_status([])
|
||||
self.check_output.assert_called_once_with(['rabbitmqctl',
|
||||
'cluster_status'])
|
||||
'cluster_status'],
|
||||
universal_newlines=True)
|
||||
self.action_set.assert_called()
|
||||
self.action_fail.assert_called()
|
||||
|
||||
|
|
Loading…
Reference in New Issue