Merge lp:~jjo/charms/trusty/rabbitmq-server/use-rabbitmqctl-q-for-list-cmds into lp:charms/trusty/rabbitmq-server

Proposed by JuanJo Ciarlante
Status: Superseded
Proposed branch: lp:~jjo/charms/trusty/rabbitmq-server/use-rabbitmqctl-q-for-list-cmds
Merge into: lp:charms/trusty/rabbitmq-server
Diff against target: 27 lines (+4/-4)
1 file modified
hooks/rabbit_utils.py (+4/-4)
To merge this branch: bzr merge lp:~jjo/charms/trusty/rabbitmq-server/use-rabbitmqctl-q-for-list-cmds
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+251645@code.launchpad.net

This proposal has been superseded by a proposal from 2015-03-03.

Commit message

[jjo, r=] use '-q' for rabbitmqctl list_vhosts and list_users, to avoid the need to filter-out informational msgs

To post a comment you must log in.
84. By JuanJo Ciarlante

rstrip() before split()

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/rabbit_utils.py'
--- hooks/rabbit_utils.py 2015-01-22 15:37:28 +0000
+++ hooks/rabbit_utils.py 2015-03-03 20:21:52 +0000
@@ -80,9 +80,9 @@
80 Returns a list of all the available vhosts80 Returns a list of all the available vhosts
81 """81 """
82 try:82 try:
83 output = subprocess.check_output([RABBITMQ_CTL, 'list_vhosts'])83 output = subprocess.check_output([RABBITMQ_CTL, 'list_vhosts', '-q'])
8484
85 return output.split('\n')[1:-2]85 return output.rstrip().split('\n')
86 except Exception as ex:86 except Exception as ex:
87 # if no vhosts, just raises an exception87 # if no vhosts, just raises an exception
88 log(str(ex), level='DEBUG')88 log(str(ex), level='DEBUG')
@@ -102,9 +102,9 @@
102102
103103
104def user_exists(user):104def user_exists(user):
105 cmd = [RABBITMQ_CTL, 'list_users']105 cmd = [RABBITMQ_CTL, 'list_users', '-q']
106 out = subprocess.check_output(cmd)106 out = subprocess.check_output(cmd)
107 for line in out.split('\n')[1:]:107 for line in out.rstrip().split('\n'):
108 _user = line.split('\t')[0]108 _user = line.split('\t')[0]
109 if _user == user:109 if _user == user:
110 admin = line.split('\t')[1]110 admin = line.split('\t')[1]

Subscribers

People subscribed via source and target branches