Fixed moved distro variable

This commit is contained in:
Joshua Harlow 2012-03-15 23:15:13 -07:00
parent 8aefa3f6b4
commit 953564ac3a
3 changed files with 9 additions and 5 deletions

View File

@ -55,7 +55,7 @@ BASE_LINK_DIR = "/etc"
class ComponentBase(object): class ComponentBase(object):
def __init__(self, def __init__(self,
subsystems, desired_subsystems,
subsystem_info, subsystem_info,
runner, runner,
component_dir, component_dir,
@ -64,7 +64,7 @@ class ComponentBase(object):
*args, *args,
**kargs): **kargs):
self.desired_subsystems = subsystems self.desired_subsystems = desired_subsystems
self.instances = all_instances self.instances = all_instances
self.component_name = name self.component_name = name
self.subsystem_info = subsystem_info self.subsystem_info = subsystem_info

View File

@ -96,6 +96,9 @@ class Distro(object):
else: else:
return root.get(end_key) return root.get(end_key)
def known_component(self, name):
return name in self._components
def supports_distro(self, distro_name): def supports_distro(self, distro_name):
"""Does this distro support the named Linux distro? """Does this distro support the named Linux distro?

View File

@ -170,7 +170,7 @@ class ActionRunner(object):
raise RuntimeError("Persona does not support distro %s" raise RuntimeError("Persona does not support distro %s"
% (self.distro.name)) % (self.distro.name))
for c in persona['components']: 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" % raise RuntimeError("Distro %s does not support component %s" %
(self.distro.name, c)) (self.distro.name, c))
except (KeyError, RuntimeError) as e: except (KeyError, RuntimeError) as e:
@ -181,7 +181,7 @@ class ActionRunner(object):
def _construct_instances(self, persona, action, root_dir): def _construct_instances(self, persona, action, root_dir):
components = persona['components'] # Required components = persona['components'] # Required
subsystems = persona.get('subsystems') or dict() # Not required desired_subsystems = persona.get('subsystems', dict()) # Not required
instances = dict() instances = dict()
for c in components: for c in components:
(cls, my_info) = self.distro.extract_component(c, action) (cls, my_info) = self.distro.extract_component(c, action)
@ -189,10 +189,11 @@ class ActionRunner(object):
cls_kvs = dict() cls_kvs = dict()
cls_kvs['runner'] = self cls_kvs['runner'] = self
cls_kvs['component_dir'] = sh.joinpths(root_dir, c) 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['all_instances'] = instances
cls_kvs['name'] = c cls_kvs['name'] = c
cls_kvs['keep_old'] = self.keep_old cls_kvs['keep_old'] = self.keep_old
cls_kvs['desired_subsystems'] = set(desired_subsystems.get(c, list()))
# The above is not overrideable... # The above is not overrideable...
for (k, v) in my_info.items(): for (k, v) in my_info.items():
if k not in cls_kvs: if k not in cls_kvs: