From c02e4195cfcf2ffcf5645c8ae3bcb35384b19899 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Andersson?= <ba@sanitarium.se>
Date: Thu, 30 Apr 2015 23:26:33 +0800
Subject: [PATCH] Ignore extra lines from Pivotal's RabbitMQ package

Pivotal's packaging of RabbitMQ shows a banner at the end of the plugin
listing talking about their official plugins. The start of the banner is
divided by a blank line so the changed plugin listing will now
break after the first empty line.

An example listing with the rabbitmq_management plugin enabled:

```
    $ rabbitmq-plugins list -E -m
    rabbitmq_management

    Pivotal officially maintains and supports the plugins:

      rabbitmq_auth_backend_ldap, rabbitmq_auth_mechanism_ssl,
      rabbitmq_consistent_hash_exchange, rabbitmq_federation,
      rabbitmq_federation_management, rabbitmq_jms_topic_exchange,
      rabbitmq_management, rabbitmq_management_agent,
      rabbitmq_mqtt, rabbitmq_shovel, rabbitmq_shovel_management,
      and rabbitmq_stomp.
```
---
 messaging/rabbitmq_plugin.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/messaging/rabbitmq_plugin.py b/messaging/rabbitmq_plugin.py
index 8d3a9428016..b52de337e2e 100644
--- a/messaging/rabbitmq_plugin.py
+++ b/messaging/rabbitmq_plugin.py
@@ -88,7 +88,14 @@ class RabbitMqPlugins(object):
         return list()
 
     def get_all(self):
-        return self._exec(['list', '-E', '-m'], True)
+        list_output = self._exec(['list', '-E', '-m'], True)
+        plugins = []
+        for plugin in list_output:
+            if not plugin:
+                break
+            plugins.append(plugin)
+
+        return plugins
 
     def enable(self, name):
         self._exec(['enable', name])
@@ -96,6 +103,7 @@ class RabbitMqPlugins(object):
     def disable(self, name):
         self._exec(['disable', name])
 
+
 def main():
     arg_spec = dict(
         names=dict(required=True, aliases=['name']),