Resolve distro package index issue

The distro packages index was not collecting packages and variables
as it should've been. This change ensures that it now is.

Change-Id: I9ba19d273658cc93456c43475694fc640b4e58b8
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-10-25 13:55:12 -05:00 committed by Kevin Carter (cloudnull)
parent d364f1bb27
commit a1be7af0aa

View File

@ -485,6 +485,9 @@ class DependencyFileProcessor(object):
if var_file_name: if var_file_name:
_name = os.path.splitext(os.path.basename(var_file_name))[0] _name = os.path.splitext(os.path.basename(var_file_name))[0]
if _name in pkg_index[role_name]:
file_name_index = pkg_index[role_name][_name]
else:
file_name_index = pkg_index[role_name][_name] = dict() file_name_index = pkg_index[role_name][_name] = dict()
pkgs = file_name_index.get(var_name, list()) pkgs = file_name_index.get(var_name, list())
pkgs = self._py_pkg_extend(packages, pkgs) pkgs = self._py_pkg_extend(packages, pkgs)
@ -540,6 +543,7 @@ class DependencyFileProcessor(object):
else: else:
project_group = 'all' project_group = 'all'
PACKAGE_MAPPING['role_project_groups'][role_name] = project_group
for key, values in loaded_config.items(): for key, values in loaded_config.items():
key = key.lower() key = key.lower()
if key.endswith('git_repo'): if key.endswith('git_repo'):
@ -740,7 +744,10 @@ class LookupModule(BASECLASS):
return_data[key] = sorted(value) return_data[key] = sorted(value)
return_data['role_requirement_files'] = ROLE_REQUIREMENTS return_data['role_requirement_files'] = ROLE_REQUIREMENTS
return_data['role_requirements'] = ROLE_BREAKOUT_REQUIREMENTS return_data['role_requirements'] = ROLE_BREAKOUT_REQUIREMENTS
return_data['role_distro_packages'] = ROLE_DISTRO_BREAKOUT_PACKAGES _dp = return_data['role_distro_packages'] = ROLE_DISTRO_BREAKOUT_PACKAGES
for k, v in PACKAGE_MAPPING['role_project_groups'].items():
if k in _dp:
_dp[k]['project_group'] = v
return [return_data] return [return_data]
def run_v1(self, terms, inject=None, **kwargs): def run_v1(self, terms, inject=None, **kwargs):
@ -791,7 +798,10 @@ class LookupModule(BASECLASS):
return_data[key] = sorted(value) return_data[key] = sorted(value)
return_data['role_requirement_files'] = ROLE_REQUIREMENTS return_data['role_requirement_files'] = ROLE_REQUIREMENTS
return_data['role_requirements'] = ROLE_BREAKOUT_REQUIREMENTS return_data['role_requirements'] = ROLE_BREAKOUT_REQUIREMENTS
return_data['role_distro_packages'] = ROLE_DISTRO_BREAKOUT_PACKAGES _dp = return_data['role_distro_packages'] = ROLE_DISTRO_BREAKOUT_PACKAGES
for k, v in PACKAGE_MAPPING['role_project_groups'].items():
if k in _dp:
_dp[k]['project_group'] = v
return [return_data] return [return_data]
# Used for testing and debuging usage: `python plugins/lookups/py_pkgs.py ../` # Used for testing and debuging usage: `python plugins/lookups/py_pkgs.py ../`