From e1ea0c68da60adabf92a91e510352ef95d735c00 Mon Sep 17 00:00:00 2001 From: Maxim Kulkin Date: Tue, 5 Nov 2013 18:29:07 +0400 Subject: [PATCH] Added fix to prevent error in some service discovery to ruin the whole process --- rubick/discovery.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/rubick/discovery.py b/rubick/discovery.py index 1648bcf..69709d3 100644 --- a/rubick/discovery.py +++ b/rubick/discovery.py @@ -249,19 +249,17 @@ class OpenstackDiscovery(object): host.id = self._collect_host_id(client) host.network_addresses = self._collect_host_network_addresses(client) - host.add_component(self._collect_keystone_data(client)) - host.add_component(self._collect_nova_api_data(client)) - host.add_component(self._collect_nova_compute_data(client)) - host.add_component(self._collect_nova_scheduler_data(client)) - host.add_component(self._collect_glance_api_data(client)) - host.add_component(self._collect_glance_registry_data(client)) - host.add_component(self._collect_cinder_api_data(client)) - host.add_component(self._collect_cinder_volume_data(client)) - host.add_component(self._collect_cinder_scheduler_data(client)) - host.add_component(self._collect_mysql_data(client)) - host.add_component(self._collect_rabbitmq_data(client)) - host.add_component(self._collect_neutron_server_data(client)) - host.add_component(self._collect_swift_proxy_server_data(client)) + for component in ['keystone', 'nova_api', 'nova_compute', + 'nova_scheduler', 'glance_api', 'glance_registry', + 'cinder_api', 'cinder_volume', 'cinder_scheduler', + 'mysql', 'rabbitmq', 'neutron_server', + 'swift_proxy_server']: + method = '_collect_%s_data' % component + if hasattr(self, method): + try: + host.add_component(getattr(self, method)(client)) + except: + traceback.print_exc() return host