Process git repos in role defaults at low priority

Instead of never processing a git repository defined in a role's
defaults, include it only if that repository is not defined somewhere
else (repo_packages). This allows for independent roles to define git
repositories without necessarily being included in this central
repository, or for the possibility of git repo definitions moving more
exclusively to tagged independent roles.

Change-Id: If303a4cd6fab9129b54879df9aed3fc8e88295ed
This commit is contained in:
Jimmy McCrory 2016-01-18 20:17:09 -08:00
parent 96abeb22b6
commit 286b0e5b1f

View File

@ -362,7 +362,7 @@ class DependencyFileProcessor(object):
if check_item:
git_data[item] = check_item
def _process_git(self, loaded_yaml, git_item):
def _process_git(self, loaded_yaml, git_item, yaml_file_name):
"""Process git repos.
:type loaded_yaml: ``dict``
@ -392,6 +392,13 @@ class DependencyFileProcessor(object):
)
git_data['egg_name'] = name.replace('-', '_')
# This conditional is set to ensure we're only processing git
# repos from the defaults file when those same repos are not
# being set in the repo_packages files.
if '/defaults/main' in yaml_file_name:
if name in GIT_PACKAGE_DEFAULT_PARTS:
return
# get the repo branch definition
git_data['branch'] = loaded_yaml.get(branch_var)
self._check_defaults(git_data, name, 'branch')
@ -449,15 +456,12 @@ class DependencyFileProcessor(object):
role_name = _role_name.split(os.sep)[0]
for key, values in loaded_config.items():
# This conditional is set to ensure we're not processes git
# repos from the defaults file which may conflict with what is
# being set in the repo_packages files.
if '/defaults/main' not in file_name:
if key.endswith('git_repo'):
self._process_git(
loaded_yaml=loaded_config,
git_item=key
)
if key.endswith('git_repo'):
self._process_git(
loaded_yaml=loaded_config,
git_item=key,
yaml_file_name=file_name
)
if [i for i in BUILT_IN_PIP_PACKAGE_VARS if i in key]:
self._py_pkg_extend(values)