2017-10-02 10:05:17 -05:00
|
|
|
# Copyright (C) 2017 Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
|
|
# implied.
|
|
|
|
#
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2017-11-21 17:05:43 -08:00
|
|
|
import os
|
2017-10-02 10:05:17 -05:00
|
|
|
import re
|
|
|
|
|
|
|
|
|
2017-11-21 17:05:43 -08:00
|
|
|
class DependencyGraph(object):
|
2017-10-02 10:05:17 -05:00
|
|
|
# This is based on the JobGraph from Zuul.
|
|
|
|
|
2017-11-21 17:05:43 -08:00
|
|
|
def __init__(self):
|
|
|
|
self._names = set()
|
|
|
|
self._dependencies = {} # dependent_name -> set(parent_names)
|
|
|
|
|
|
|
|
def add(self, name, dependencies):
|
|
|
|
# Append the dependency information
|
|
|
|
self._dependencies.setdefault(name, set())
|
|
|
|
try:
|
|
|
|
for dependency in dependencies:
|
|
|
|
# Make sure a circular dependency is never created
|
|
|
|
ancestors = self._getParentNamesRecursively(
|
|
|
|
dependency, soft=True)
|
|
|
|
ancestors.add(dependency)
|
|
|
|
if name in ancestors:
|
|
|
|
raise Exception("Dependency cycle detected in {}".
|
|
|
|
format(name))
|
|
|
|
self._dependencies[name].add(dependency)
|
|
|
|
except Exception:
|
|
|
|
del self._dependencies[name]
|
|
|
|
raise
|
|
|
|
|
|
|
|
def getDependenciesRecursively(self, parent):
|
|
|
|
dependencies = []
|
|
|
|
|
|
|
|
current_dependencies = self._dependencies[parent]
|
|
|
|
for current in current_dependencies:
|
|
|
|
if current not in dependencies:
|
|
|
|
dependencies.append(current)
|
|
|
|
for dep in self.getDependenciesRecursively(current):
|
|
|
|
if dep not in dependencies:
|
|
|
|
dependencies.append(dep)
|
|
|
|
return dependencies
|
|
|
|
|
|
|
|
def _getParentNamesRecursively(self, dependent, soft=False):
|
|
|
|
all_parent_items = set()
|
|
|
|
items_to_iterate = set([dependent])
|
|
|
|
while len(items_to_iterate) > 0:
|
|
|
|
current_item = items_to_iterate.pop()
|
|
|
|
current_parent_items = self._dependencies.get(current_item)
|
|
|
|
if current_parent_items is None:
|
|
|
|
if soft:
|
|
|
|
current_parent_items = set()
|
|
|
|
else:
|
|
|
|
raise Exception("Dependent item {} not found: ".format(
|
|
|
|
dependent))
|
|
|
|
new_parent_items = current_parent_items - all_parent_items
|
|
|
|
items_to_iterate |= new_parent_items
|
|
|
|
all_parent_items |= new_parent_items
|
|
|
|
return all_parent_items
|
|
|
|
|
|
|
|
|
|
|
|
class VarGraph(DependencyGraph):
|
2017-10-02 10:05:17 -05:00
|
|
|
def __init__(self, vars):
|
2017-11-21 17:05:43 -08:00
|
|
|
super(VarGraph, self).__init__()
|
2017-10-02 10:05:17 -05:00
|
|
|
self.vars = {}
|
|
|
|
self._varnames = set()
|
|
|
|
for k, v in vars.items():
|
|
|
|
self._varnames.add(k)
|
|
|
|
for k, v in vars.items():
|
|
|
|
self._addVar(k, str(v))
|
|
|
|
|
|
|
|
bash_var_re = re.compile(r'\$\{?(\w+)')
|
|
|
|
def getDependencies(self, value):
|
|
|
|
return self.bash_var_re.findall(value)
|
|
|
|
|
|
|
|
def _addVar(self, key, value):
|
|
|
|
if key in self.vars:
|
|
|
|
raise Exception("Variable {} already added".format(key))
|
|
|
|
self.vars[key] = value
|
|
|
|
# Append the dependency information
|
2017-11-21 17:05:43 -08:00
|
|
|
dependencies = set()
|
|
|
|
for dependency in self.getDependencies(value):
|
|
|
|
if dependency == key:
|
|
|
|
# A variable is allowed to reference itself; no
|
|
|
|
# dependency link needed in that case.
|
|
|
|
continue
|
|
|
|
if dependency not in self._varnames:
|
|
|
|
# It's not necessary to create a link for an
|
|
|
|
# external variable.
|
|
|
|
continue
|
|
|
|
dependencies.add(dependency)
|
2017-10-02 10:05:17 -05:00
|
|
|
try:
|
2017-11-21 17:05:43 -08:00
|
|
|
self.add(key, dependencies)
|
2017-10-02 10:05:17 -05:00
|
|
|
except Exception:
|
|
|
|
del self.vars[key]
|
|
|
|
raise
|
|
|
|
|
|
|
|
def getVars(self):
|
|
|
|
ret = []
|
|
|
|
keys = sorted(self.vars.keys())
|
|
|
|
seen = set()
|
|
|
|
for key in keys:
|
2017-11-21 17:05:43 -08:00
|
|
|
dependencies = self.getDependenciesRecursively(key)
|
2017-10-02 10:05:17 -05:00
|
|
|
for var in dependencies + [key]:
|
|
|
|
if var not in seen:
|
|
|
|
ret.append((var, self.vars[var]))
|
|
|
|
seen.add(var)
|
|
|
|
return ret
|
|
|
|
|
2017-11-21 17:05:43 -08:00
|
|
|
|
|
|
|
class PluginGraph(DependencyGraph):
|
|
|
|
def __init__(self, base_dir, plugins):
|
|
|
|
super(PluginGraph, self).__init__()
|
|
|
|
# The dependency trees expressed by all the plugins we found
|
|
|
|
# (which may be more than those the job is using).
|
|
|
|
self._plugin_dependencies = {}
|
|
|
|
self.loadPluginNames(base_dir)
|
|
|
|
|
|
|
|
self.plugins = {}
|
|
|
|
self._pluginnames = set()
|
|
|
|
for k, v in plugins.items():
|
|
|
|
self._pluginnames.add(k)
|
|
|
|
for k, v in plugins.items():
|
|
|
|
self._addPlugin(k, str(v))
|
|
|
|
|
|
|
|
def loadPluginNames(self, base_dir):
|
|
|
|
if base_dir is None:
|
|
|
|
return
|
|
|
|
git_roots = []
|
|
|
|
for root, dirs, files in os.walk(base_dir):
|
|
|
|
if '.git' not in dirs:
|
|
|
|
continue
|
|
|
|
# Don't go deeper than git roots
|
|
|
|
dirs[:] = []
|
|
|
|
git_roots.append(root)
|
|
|
|
for root in git_roots:
|
|
|
|
devstack = os.path.join(root, 'devstack')
|
|
|
|
if not (os.path.exists(devstack) and os.path.isdir(devstack)):
|
|
|
|
continue
|
|
|
|
settings = os.path.join(devstack, 'settings')
|
|
|
|
if not (os.path.exists(settings) and os.path.isfile(settings)):
|
|
|
|
continue
|
|
|
|
self.loadDevstackPluginInfo(settings)
|
|
|
|
|
2018-12-19 12:20:51 +00:00
|
|
|
define_re = re.compile(r'^define_plugin\s+(\S+).*')
|
|
|
|
require_re = re.compile(r'^plugin_requires\s+(\S+)\s+(\S+).*')
|
2017-11-21 17:05:43 -08:00
|
|
|
def loadDevstackPluginInfo(self, fn):
|
|
|
|
name = None
|
|
|
|
reqs = set()
|
|
|
|
with open(fn) as f:
|
|
|
|
for line in f:
|
|
|
|
m = self.define_re.match(line)
|
|
|
|
if m:
|
|
|
|
name = m.group(1)
|
|
|
|
m = self.require_re.match(line)
|
|
|
|
if m:
|
|
|
|
if name == m.group(1):
|
|
|
|
reqs.add(m.group(2))
|
|
|
|
if name and reqs:
|
|
|
|
self._plugin_dependencies[name] = reqs
|
|
|
|
|
|
|
|
def getDependencies(self, value):
|
|
|
|
return self._plugin_dependencies.get(value, [])
|
|
|
|
|
|
|
|
def _addPlugin(self, key, value):
|
|
|
|
if key in self.plugins:
|
|
|
|
raise Exception("Plugin {} already added".format(key))
|
|
|
|
self.plugins[key] = value
|
|
|
|
# Append the dependency information
|
|
|
|
dependencies = set()
|
|
|
|
for dependency in self.getDependencies(key):
|
|
|
|
if dependency == key:
|
|
|
|
continue
|
|
|
|
dependencies.add(dependency)
|
|
|
|
try:
|
|
|
|
self.add(key, dependencies)
|
|
|
|
except Exception:
|
|
|
|
del self.plugins[key]
|
|
|
|
raise
|
|
|
|
|
|
|
|
def getPlugins(self):
|
|
|
|
ret = []
|
|
|
|
keys = sorted(self.plugins.keys())
|
|
|
|
seen = set()
|
|
|
|
for key in keys:
|
|
|
|
dependencies = self.getDependenciesRecursively(key)
|
|
|
|
for plugin in dependencies + [key]:
|
|
|
|
if plugin not in seen:
|
|
|
|
ret.append((plugin, self.plugins[plugin]))
|
|
|
|
seen.add(plugin)
|
|
|
|
return ret
|
2017-10-02 10:05:17 -05:00
|
|
|
|
|
|
|
|
|
|
|
class LocalConf(object):
|
|
|
|
|
2017-11-21 17:05:43 -08:00
|
|
|
def __init__(self, localrc, localconf, base_services, services, plugins,
|
2019-03-12 22:25:44 +01:00
|
|
|
base_dir, projects, project, tempest_plugins):
|
2017-10-02 10:05:17 -05:00
|
|
|
self.localrc = []
|
2019-03-12 22:25:44 +01:00
|
|
|
self.warnings = []
|
2017-10-02 10:05:17 -05:00
|
|
|
self.meta_sections = {}
|
2017-11-21 17:05:43 -08:00
|
|
|
self.plugin_deps = {}
|
|
|
|
self.base_dir = base_dir
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
self.projects = projects
|
2018-06-15 10:10:35 -07:00
|
|
|
self.project = project
|
2019-03-12 22:25:44 +01:00
|
|
|
self.tempest_plugins = tempest_plugins
|
2017-12-01 17:36:38 +00:00
|
|
|
if services or base_services:
|
|
|
|
self.handle_services(base_services, services or {})
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
self.handle_localrc(localrc)
|
2019-02-26 18:39:51 +01:00
|
|
|
# Plugins must be the last items in localrc, otherwise
|
|
|
|
# the configuration lines which follows them in the file are
|
|
|
|
# not applied to the plugins (for example, the value of DEST.)
|
|
|
|
if plugins:
|
|
|
|
self.handle_plugins(plugins)
|
2017-10-02 10:05:17 -05:00
|
|
|
if localconf:
|
|
|
|
self.handle_localconf(localconf)
|
|
|
|
|
|
|
|
def handle_plugins(self, plugins):
|
2017-11-21 17:05:43 -08:00
|
|
|
pg = PluginGraph(self.base_dir, plugins)
|
|
|
|
for k, v in pg.getPlugins():
|
2017-10-02 10:05:17 -05:00
|
|
|
if v:
|
|
|
|
self.localrc.append('enable_plugin {} {}'.format(k, v))
|
|
|
|
|
2017-12-01 17:36:38 +00:00
|
|
|
def handle_services(self, base_services, services):
|
|
|
|
enable_base_services = services.pop('base', True)
|
|
|
|
if enable_base_services and base_services:
|
|
|
|
self.localrc.append('ENABLED_SERVICES={}'.format(
|
|
|
|
",".join(base_services)))
|
|
|
|
else:
|
2017-11-30 15:49:39 +00:00
|
|
|
self.localrc.append('disable_all_services')
|
2017-10-02 10:05:17 -05:00
|
|
|
for k, v in services.items():
|
|
|
|
if v is False:
|
|
|
|
self.localrc.append('disable_service {}'.format(k))
|
|
|
|
elif v is True:
|
|
|
|
self.localrc.append('enable_service {}'.format(k))
|
|
|
|
|
|
|
|
def handle_localrc(self, localrc):
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
lfg = False
|
2019-03-12 22:25:44 +01:00
|
|
|
tp = False
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
if localrc:
|
|
|
|
vg = VarGraph(localrc)
|
|
|
|
for k, v in vg.getVars():
|
2019-04-01 11:43:28 +00:00
|
|
|
# Avoid double quoting
|
|
|
|
if len(v) and v[0]=='"':
|
|
|
|
self.localrc.append('{}={}'.format(k, v))
|
|
|
|
else:
|
|
|
|
self.localrc.append('{}="{}"'.format(k, v))
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
if k == 'LIBS_FROM_GIT':
|
|
|
|
lfg = True
|
2019-03-12 22:25:44 +01:00
|
|
|
elif k == 'TEMPEST_PLUGINS':
|
|
|
|
tp = True
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
|
2018-06-15 10:10:35 -07:00
|
|
|
if not lfg and (self.projects or self.project):
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
required_projects = []
|
2018-06-15 10:10:35 -07:00
|
|
|
if self.projects:
|
|
|
|
for project_name, project_info in self.projects.items():
|
|
|
|
if project_info.get('required'):
|
|
|
|
required_projects.append(project_info['short_name'])
|
|
|
|
if self.project:
|
|
|
|
if self.project['short_name'] not in required_projects:
|
|
|
|
required_projects.append(self.project['short_name'])
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
if required_projects:
|
|
|
|
self.localrc.append('LIBS_FROM_GIT={}'.format(
|
|
|
|
','.join(required_projects)))
|
2017-10-02 10:05:17 -05:00
|
|
|
|
2019-03-12 22:25:44 +01:00
|
|
|
if self.tempest_plugins:
|
|
|
|
if not tp:
|
|
|
|
tp_dirs = []
|
|
|
|
for tempest_plugin in self.tempest_plugins:
|
|
|
|
tp_dirs.append(os.path.join(self.base_dir, tempest_plugin))
|
|
|
|
self.localrc.append('TEMPEST_PLUGINS="{}"'.format(
|
|
|
|
' '.join(tp_dirs)))
|
|
|
|
else:
|
|
|
|
self.warnings.append('TEMPEST_PLUGINS already defined ({}),'
|
|
|
|
'requested value {} ignored'.format(
|
|
|
|
tp, self.tempest_plugins))
|
|
|
|
|
|
|
|
|
2017-10-02 10:05:17 -05:00
|
|
|
def handle_localconf(self, localconf):
|
|
|
|
for phase, phase_data in localconf.items():
|
|
|
|
for fn, fn_data in phase_data.items():
|
|
|
|
ms_name = '[[{}|{}]]'.format(phase, fn)
|
|
|
|
ms_data = []
|
|
|
|
for section, section_data in fn_data.items():
|
|
|
|
ms_data.append('[{}]'.format(section))
|
|
|
|
for k, v in section_data.items():
|
|
|
|
ms_data.append('{} = {}'.format(k, v))
|
|
|
|
ms_data.append('')
|
|
|
|
self.meta_sections[ms_name] = ms_data
|
|
|
|
|
|
|
|
def write(self, path):
|
|
|
|
with open(path, 'w') as f:
|
|
|
|
f.write('[[local|localrc]]\n')
|
|
|
|
f.write('\n'.join(self.localrc))
|
|
|
|
f.write('\n\n')
|
|
|
|
for section, lines in self.meta_sections.items():
|
|
|
|
f.write('{}\n'.format(section))
|
|
|
|
f.write('\n'.join(lines))
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=dict(
|
|
|
|
plugins=dict(type='dict'),
|
2017-12-01 17:36:38 +00:00
|
|
|
base_services=dict(type='list'),
|
2017-10-02 10:05:17 -05:00
|
|
|
services=dict(type='dict'),
|
|
|
|
localrc=dict(type='dict'),
|
|
|
|
local_conf=dict(type='dict'),
|
2017-11-21 17:05:43 -08:00
|
|
|
base_dir=dict(type='path'),
|
2017-10-02 10:05:17 -05:00
|
|
|
path=dict(type='str'),
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
projects=dict(type='dict'),
|
2018-06-15 10:10:35 -07:00
|
|
|
project=dict(type='dict'),
|
2019-03-12 22:25:44 +01:00
|
|
|
tempest_plugins=dict(type='list'),
|
2017-10-02 10:05:17 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
p = module.params
|
|
|
|
lc = LocalConf(p.get('localrc'),
|
|
|
|
p.get('local_conf'),
|
2017-12-01 17:36:38 +00:00
|
|
|
p.get('base_services'),
|
2017-10-02 10:05:17 -05:00
|
|
|
p.get('services'),
|
2017-11-21 17:05:43 -08:00
|
|
|
p.get('plugins'),
|
Automatically set LIBS_FROM_GIT based on required projects
If a project shows up in zuul's required-projects list, add it
to LIBS_FROM_GIT automatically. This way, when a user specifies
that a job requires a zuul-project, it gets used in testing, but
otherwise, it doesn't (pypi is used instead).
Also add information about what happens behind the scenes for both
LIBS_FROM_GIT and plugin dependencies.
This moves the check performed in check_libs_from_git to
a helper function which is installed for most kinds of
installations. This means that if someone sets LIBS_FROM_GIT to
"foobar", devstack won't error anymore, as nothing is going to
try to install foobar, therefore the check won't run on that.
However, as we move to automated generation of the local config,
that error is not likely to happen. This check was originally
added due to an error in the upper-constraints file (where a
constraint name did not match a package name). This location of
the check would still catch that type of error.
Change-Id: Ifcf3ad008cf42d3d4762cfb3b6c31c93cfeb40db
2018-03-02 15:05:14 +00:00
|
|
|
p.get('base_dir'),
|
2018-06-15 10:10:35 -07:00
|
|
|
p.get('projects'),
|
2019-03-12 22:25:44 +01:00
|
|
|
p.get('project'),
|
|
|
|
p.get('tempest_plugins'))
|
2017-10-02 10:05:17 -05:00
|
|
|
lc.write(p['path'])
|
|
|
|
|
2019-03-12 22:25:44 +01:00
|
|
|
module.exit_json(warnings=lc.warnings)
|
2017-10-02 10:05:17 -05:00
|
|
|
|
|
|
|
|
2017-11-21 17:05:43 -08:00
|
|
|
try:
|
|
|
|
from ansible.module_utils.basic import * # noqa
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
except ImportError:
|
|
|
|
pass
|
2017-10-02 10:05:17 -05:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|