From 953564ac3ab3cfc775dcb3362132c5ffb81ab6f2 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 15 Mar 2012 23:15:13 -0700 Subject: [PATCH] Fixed moved distro variable --- devstack/component.py | 4 ++-- devstack/distro.py | 3 +++ devstack/progs/actions.py | 7 ++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/devstack/component.py b/devstack/component.py index b200d018..525daf99 100644 --- a/devstack/component.py +++ b/devstack/component.py @@ -55,7 +55,7 @@ BASE_LINK_DIR = "/etc" class ComponentBase(object): def __init__(self, - subsystems, + desired_subsystems, subsystem_info, runner, component_dir, @@ -64,7 +64,7 @@ class ComponentBase(object): *args, **kargs): - self.desired_subsystems = subsystems + self.desired_subsystems = desired_subsystems self.instances = all_instances self.component_name = name self.subsystem_info = subsystem_info diff --git a/devstack/distro.py b/devstack/distro.py index 10599a67..99d4fe90 100644 --- a/devstack/distro.py +++ b/devstack/distro.py @@ -96,6 +96,9 @@ class Distro(object): else: return root.get(end_key) + def known_component(self, name): + return name in self._components + def supports_distro(self, distro_name): """Does this distro support the named Linux distro? diff --git a/devstack/progs/actions.py b/devstack/progs/actions.py index 75a4402a..32d09cf3 100644 --- a/devstack/progs/actions.py +++ b/devstack/progs/actions.py @@ -170,7 +170,7 @@ class ActionRunner(object): raise RuntimeError("Persona does not support distro %s" % (self.distro.name)) for c in persona['components']: - if c not in self.distro.components: + if not self.distro.known_component(c): raise RuntimeError("Distro %s does not support component %s" % (self.distro.name, c)) except (KeyError, RuntimeError) as e: @@ -181,7 +181,7 @@ class ActionRunner(object): def _construct_instances(self, persona, action, root_dir): components = persona['components'] # Required - subsystems = persona.get('subsystems') or dict() # Not required + desired_subsystems = persona.get('subsystems', dict()) # Not required instances = dict() for c in components: (cls, my_info) = self.distro.extract_component(c, action) @@ -189,10 +189,11 @@ class ActionRunner(object): cls_kvs = dict() cls_kvs['runner'] = self cls_kvs['component_dir'] = sh.joinpths(root_dir, c) - cls_kvs['subsystem_info'] = subsystems.get(c, dict()) + cls_kvs['subsystem_info'] = my_info.pop('subsystems', dict()) cls_kvs['all_instances'] = instances cls_kvs['name'] = c cls_kvs['keep_old'] = self.keep_old + cls_kvs['desired_subsystems'] = set(desired_subsystems.get(c, list())) # The above is not overrideable... for (k, v) in my_info.items(): if k not in cls_kvs: