Skip to content

Commit

Permalink
rework getQueuesRelMap() to use the API data
Browse files Browse the repository at this point in the history
  • Loading branch information
alienth committed Apr 26, 2012
1 parent 5fbd678 commit 1393b5a
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions ZenPacks/community/RabbitMQ/modeler/plugins/zenoss/http/RabbitMQ.py
Expand Up @@ -102,10 +102,10 @@ def getVHostRelMap(self, device, results, compname):
'title': vhost_title, 'title': vhost_title,
})) }))


exchanges = self.getExchangeRelMap(results['exchanges'], vhost_id, exchanges = self.getExchangeRelMap(results['exchanges'], vhost_title,
'%s/rabbitmq_vhosts/%s' % (compname, vhost_id)) '%s/rabbitmq_vhosts/%s' % (compname, vhost_id))


queues = self.getQueueRelMap(results['queues'], vhost_id, queues = self.getQueueRelMap(results['queues'], vhost_title,
'%s/rabbitmq_vhosts/%s' % (compname, vhost_id)) '%s/rabbitmq_vhosts/%s' % (compname, vhost_id))


LOG.info( LOG.info(
Expand Down Expand Up @@ -152,29 +152,17 @@ def getExchangeRelMap(self, vhost, exchanges, compname):


def getQueueRelMap(self, vhost, queues, compname): def getQueueRelMap(self, vhost, queues, compname):
object_maps = [] object_maps = []
for queue_string in queues_string.split('\n'):
if not queue_string.strip():
continue

name, durable, auto_delete, arguments = \
re.split(r'\s+', queue_string)

if re.search(r'true', durable, re.I):
durable = True
else:
durable = False


if re.search(r'true', auto_delete, re.I): for item in queues:
auto_delete = True if not item['vhost'] == vhost:
else: continue
auto_delete = False


object_maps.append(ObjectMap(data={ object_maps.append(ObjectMap(data={
'id': prepId(name), 'id': prepId(item['name']),
'title': name, 'title': item['name'],
'durable': durable, 'durable': item['durable'],
'auto_delete': auto_delete, 'auto_delete': item['auto_delete'],
'arguments': arguments, 'arguments': ','.join(chain(*item.['arguments'].items())),
})) }))


return RelationshipMap( return RelationshipMap(
Expand Down

0 comments on commit 1393b5a

Please sign in to comment.