Skip to content
Browse files

rework getQueuesRelMap() to use the API data

  • Loading branch information...
1 parent 5fbd678 commit 1393b5a257a194de8f6b84a46eff2c8b2dd5c714 @alienth committed Apr 25, 2012
Showing with 10 additions and 22 deletions.
  1. +10 −22 ZenPacks/community/RabbitMQ/modeler/plugins/zenoss/http/RabbitMQ.py
View
32 ZenPacks/community/RabbitMQ/modeler/plugins/zenoss/http/RabbitMQ.py
@@ -102,10 +102,10 @@ def getVHostRelMap(self, device, results, compname):
'title': vhost_title,
}))
- exchanges = self.getExchangeRelMap(results['exchanges'], vhost_id,
+ exchanges = self.getExchangeRelMap(results['exchanges'], vhost_title,
'%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))
LOG.info(
@@ -152,29 +152,17 @@ def getExchangeRelMap(self, vhost, exchanges, compname):
def getQueueRelMap(self, vhost, queues, compname):
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):
- auto_delete = True
- else:
- auto_delete = False
+ for item in queues:
+ if not item['vhost'] == vhost:
+ continue
object_maps.append(ObjectMap(data={
- 'id': prepId(name),
- 'title': name,
- 'durable': durable,
- 'auto_delete': auto_delete,
- 'arguments': arguments,
+ 'id': prepId(item['name']),
+ 'title': item['name'],
+ 'durable': item['durable'],
+ 'auto_delete': item['auto_delete'],
+ 'arguments': ','.join(chain(*item.['arguments'].items())),
}))
return RelationshipMap(

0 comments on commit 1393b5a

Please sign in to comment.
Something went wrong with that request. Please try again.