Merge "Don't use the private variable _dependency_handler directly."
This commit is contained in:
commit
11841b2e67
@ -48,14 +48,9 @@ class Distro(object):
|
||||
self._commands = commands
|
||||
self._components = components
|
||||
|
||||
def get_command_config(self, key, *more_keys, **kargs):
|
||||
"""Gets a end object for a given set of keys """
|
||||
root = self._commands
|
||||
acutal_keys = [key] + list(more_keys)
|
||||
run_over_keys = acutal_keys[0:-1]
|
||||
end_key = acutal_keys[-1]
|
||||
quiet = kargs.get('quiet', False)
|
||||
for k in run_over_keys:
|
||||
def _fetch_value(self, root, keys, quiet):
|
||||
end_key = keys[-1]
|
||||
for k in keys[0:-1]:
|
||||
if quiet:
|
||||
root = root.get(k)
|
||||
if root is None:
|
||||
@ -69,11 +64,24 @@ class Distro(object):
|
||||
end_value = root.get(end_key)
|
||||
return end_value
|
||||
|
||||
def get_command(self, key, *more_keys, **kargs):
|
||||
def get_dependency_config(self, key, *more_keys, **kwargs):
|
||||
root = dict(self._dependency_handler)
|
||||
# NOTE(harlowja): Don't allow access to the dependency handler class
|
||||
# name. Access should be via the property instead.
|
||||
root.pop('name', None)
|
||||
keys = [key] + list(more_keys)
|
||||
return self._fetch_value(root, keys, kwargs.get('quiet', False))
|
||||
|
||||
def get_command_config(self, key, *more_keys, **kwargs):
|
||||
root = dict(self._commands)
|
||||
keys = [key] + list(more_keys)
|
||||
return self._fetch_value(root, keys, kwargs.get('quiet', False))
|
||||
|
||||
def get_command(self, key, *more_keys, **kwargs):
|
||||
"""Retrieves a string for running a command from the setup
|
||||
and splits it to return a list.
|
||||
"""
|
||||
val = self.get_command_config(key, *more_keys, **kargs)
|
||||
val = self.get_command_config(key, *more_keys, **kwargs)
|
||||
if not val:
|
||||
return []
|
||||
else:
|
||||
|
@ -117,17 +117,17 @@ class YumDependencyHandler(base.DependencyHandler):
|
||||
"--epoch-map",
|
||||
] + ["%s==%s" % (name, self.OPENSTACK_EPOCH)
|
||||
for name in self.python_names]
|
||||
package_map = self.distro._dependency_handler.get("package_map", {})
|
||||
package_map = self.distro.get_dependency_config("package_map")
|
||||
if package_map:
|
||||
cmdline += [
|
||||
"--package-map",
|
||||
] + ["%s==%s" % (key, value)
|
||||
for key, value in package_map.iteritems()]
|
||||
arch_dependent = self.distro._dependency_handler.get("arch_dependent", [])
|
||||
arch_dependent = self.distro.get_dependency_config("arch_dependent")
|
||||
if arch_dependent:
|
||||
cmdline += [
|
||||
"--arch-dependent",
|
||||
] + arch_dependent
|
||||
] + list(arch_dependent)
|
||||
return cmdline
|
||||
|
||||
def _package_parameters(self, instance):
|
||||
|
Loading…
Reference in New Issue
Block a user