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
1=== modified file 'hooks/rabbit_utils.py'
2--- hooks/rabbit_utils.py 2015-01-22 15:37:28 +0000
3+++ hooks/rabbit_utils.py 2015-03-03 20:21:52 +0000
4@@ -80,9 +80,9 @@
5 Returns a list of all the available vhosts
6 """
7 try:
8- output = subprocess.check_output([RABBITMQ_CTL, 'list_vhosts'])
9+ output = subprocess.check_output([RABBITMQ_CTL, 'list_vhosts', '-q'])
10
11- return output.split('\n')[1:-2]
12+ return output.rstrip().split('\n')
13 except Exception as ex:
14 # if no vhosts, just raises an exception
15 log(str(ex), level='DEBUG')
16@@ -102,9 +102,9 @@
17
18
19 def user_exists(user):
20- cmd = [RABBITMQ_CTL, 'list_users']
21+ cmd = [RABBITMQ_CTL, 'list_users', '-q']
22 out = subprocess.check_output(cmd)
23- for line in out.split('\n')[1:]:
24+ for line in out.rstrip().split('\n'):
25 _user = line.split('\t')[0]
26 if _user == user:
27 admin = line.split('\t')[1]

Subscribers

People subscribed via source and target branches