Small code improvements.

* avoid None iteration in configs util
* display instances in cluster details
* display more info while provisioning cluster

Change-Id: I33026468911a3f93695468cde8d67db02485a77a
This commit is contained in:
Sergey Lukjanov 2013-06-08 22:26:01 +04:00
parent 79efb349a1
commit 66b333054b
3 changed files with 13 additions and 5 deletions

View File

@ -135,6 +135,12 @@ class NodeGroup(mb.SavannaBase, mb.IdMixin, mb.ExtraMixin):
return self._all_configs return self._all_configs
def to_dict(self):
d = super(NodeGroup, self).to_dict()
d['instances'] = [i.dict for i in self.instances]
return d
class Instance(mb.SavannaBase, mb.ExtraMixin): class Instance(mb.SavannaBase, mb.ExtraMixin):
"""An OpenStack instance created for the cluster.""" """An OpenStack instance created for the cluster."""

View File

@ -131,7 +131,8 @@ def _check_if_up(instance):
if exit_code: if exit_code:
return False return False
except Exception as ex: except Exception as ex:
LOG.debug("Can't login to node %s reason %s", server.name, ex) LOG.debug("Can't login to node %s (%s), reason %s",
server.name, instance.management_ip, ex)
return False return False
instance._is_up = True instance._is_up = True

View File

@ -23,9 +23,10 @@ def merge_configs(*configs):
""" """
result = {} result = {}
for config in configs: for config in configs:
for a_target in config: if config:
if a_target not in result or not result[a_target]: for a_target in config:
result[a_target] = {} if a_target not in result or not result[a_target]:
result[a_target].update(config[a_target]) result[a_target] = {}
result[a_target].update(config[a_target])
return result return result