Add default kolla conf file for TripleO to build container images

A default kolla conf file is added to the tripleo-common-continers
package, which should be added for building container images by
default.
Closes-Bug: #1712732
Depends-On: I9a2d6b48eb44e294a8501ac0768ea0b97abb4b5c

Change-Id: Id7c665593d8105cadb90bcc7d10b91b17e430922
This commit is contained in:
Saravanan KR 2017-09-04 13:45:34 +05:30
parent f2715ebc55
commit 3f58d0db0f
3 changed files with 17 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Added a default kolla conf file for the container image building command

View File

@ -18,6 +18,7 @@ import mock
import os
import shutil
import six
import sys
import tempfile
import yaml
@ -241,6 +242,10 @@ class TestContainerImageBuild(TestPluginV1):
self.cmd = container_image.BuildImage(self.app, None)
self.cmd.app.stdout = six.StringIO()
self.temp_dir = self.useFixture(fixtures.TempDir()).join()
# Default conf file
self.default_kolla_conf = os.path.join(
sys.prefix, 'share', 'tripleo-common', 'container-images',
'tripleo_kolla_config_overrides.conf')
@mock.patch('sys.exit')
@mock.patch('tripleo_common.image.kolla_builder.KollaImageBuilder',
@ -284,7 +289,7 @@ class TestContainerImageBuild(TestPluginV1):
mock_builder.assert_called_once_with([
'/tmp/foo.yaml', '/tmp/bar.yaml'])
mock_builder.return_value.build_images.assert_called_once_with([
'/tmp/kolla.conf',
self.default_kolla_conf, '/tmp/kolla.conf',
path
])

View File

@ -82,6 +82,9 @@ class BuildImage(command.Command):
images.append(dep)
def get_parser(self, prog_name):
default_kolla_conf = os.path.join(
sys.prefix, 'share', 'tripleo-common', 'container-images',
'tripleo_kolla_config_overrides.conf')
parser = super(BuildImage, self).get_parser(prog_name)
parser.add_argument(
"--config-file",
@ -99,12 +102,13 @@ class BuildImage(command.Command):
"--kolla-config-file",
dest="kolla_config_files",
metavar='<config file>',
default=[],
default=[default_kolla_conf],
action="append",
required=True,
help=_("Path to a Kolla config file to use. Multiple config files "
"can be specified, with values in later files taking "
"precedence."),
"precedence. By default, tripleo kolla conf file {conf} "
"is added.").format(conf=default_kolla_conf),
)
parser.add_argument(
'--list-images',