Merge "Fix the package source don't register issue"
This commit is contained in:
commit
459d564573
@ -518,7 +518,8 @@ class KollaWorker(object):
|
|||||||
def build_image_list(self):
|
def build_image_list(self):
|
||||||
def process_source_installation(image, section):
|
def process_source_installation(image, section):
|
||||||
installation = dict()
|
installation = dict()
|
||||||
if section not in self.conf.list_all_sections():
|
# NOTE(jeffrey4l): source is not needed when the type is None
|
||||||
|
if self.conf._get('type', self.conf._get_group(section)) is None:
|
||||||
LOG.debug('%s:No source location found', section)
|
LOG.debug('%s:No source location found', section)
|
||||||
else:
|
else:
|
||||||
installation['type'] = self.conf[section]['type']
|
installation['type'] = self.conf[section]['type']
|
||||||
@ -546,17 +547,17 @@ class KollaWorker(object):
|
|||||||
image['plugins'] = list()
|
image['plugins'] = list()
|
||||||
|
|
||||||
if self.install_type == 'source':
|
if self.install_type == 'source':
|
||||||
self.conf.register_opts([
|
# NOTE(jeffrey4l): register the opts if the section didn't
|
||||||
cfg.StrOpt('type'),
|
# register in the kolla/common/config.py file
|
||||||
cfg.StrOpt('location'),
|
if image['name'] not in self.conf._groups:
|
||||||
cfg.StrOpt('reference')
|
self.conf.register_opts(common_config.get_source_opts(),
|
||||||
], image['name'])
|
image['name'])
|
||||||
image['source'] = process_source_installation(image,
|
image['source'] = process_source_installation(image,
|
||||||
image['name'])
|
image['name'])
|
||||||
for plugin in [match.group(0) for match in
|
for plugin in [match.group(0) for match in
|
||||||
(re.search('{}-plugin-.+'.format(image['name']),
|
(re.search('{}-plugin-.+'.format(image['name']),
|
||||||
section) for section in
|
section) for section in
|
||||||
self.conf.list_all_sections()) if match]:
|
self.conf._groups) if match]:
|
||||||
image['plugins'].append(
|
image['plugins'].append(
|
||||||
process_source_installation(image, plugin))
|
process_source_installation(image, plugin))
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ SOURCES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _get_source_opt(type_, location, reference=None):
|
def get_source_opts(type_=None, location=None, reference=None):
|
||||||
return [cfg.StrOpt('type', choices=['git', 'url'],
|
return [cfg.StrOpt('type', choices=['git', 'url'],
|
||||||
default=type_,
|
default=type_,
|
||||||
help='Source location type'),
|
help='Source location type'),
|
||||||
@ -236,19 +236,19 @@ def _get_source_opt(type_, location, reference=None):
|
|||||||
'or branch name'))]
|
'or branch name'))]
|
||||||
|
|
||||||
|
|
||||||
def gen_source_opts():
|
def gen_all_source_opts():
|
||||||
for name, params in SOURCES.iteritems():
|
for name, params in SOURCES.iteritems():
|
||||||
type_ = params['type']
|
type_ = params['type']
|
||||||
location = params['location']
|
location = params['location']
|
||||||
reference = params.get('reference')
|
reference = params.get('reference')
|
||||||
yield name, _get_source_opt(type_, location, reference)
|
yield name, get_source_opts(type_, location, reference)
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return itertools.chain([(None, _CLI_OPTS),
|
return itertools.chain([(None, _CLI_OPTS),
|
||||||
(None, _BASE_OPTS),
|
(None, _BASE_OPTS),
|
||||||
('profiles', _PROFILE_OPTS)],
|
('profiles', _PROFILE_OPTS)],
|
||||||
gen_source_opts(),
|
gen_all_source_opts(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -257,6 +257,8 @@ def parse(conf, args, usage=None, prog=None,
|
|||||||
conf.register_cli_opts(_CLI_OPTS)
|
conf.register_cli_opts(_CLI_OPTS)
|
||||||
conf.register_opts(_BASE_OPTS)
|
conf.register_opts(_BASE_OPTS)
|
||||||
conf.register_opts(_PROFILE_OPTS, group='profiles')
|
conf.register_opts(_PROFILE_OPTS, group='profiles')
|
||||||
|
for name, opts in gen_all_source_opts():
|
||||||
|
conf.register_opts(opts, name)
|
||||||
|
|
||||||
conf(args=args,
|
conf(args=args,
|
||||||
project='kolla',
|
project='kolla',
|
||||||
|
Loading…
Reference in New Issue
Block a user