Make config options required
Since we're not providing a default, we should make the --config-file and --kolla-config options required to ensure that people don't execute it without options and wonder why nothing occured. Change-Id: If6df69de9c0ded8b9f8975adfe8cd63cb619ca05 Closes-Bug: #1699158
This commit is contained in:
parent
6030cd1ab6
commit
e1a4458061
@ -27,18 +27,18 @@ class TestContainerImageUpload(TestPluginV1):
|
||||
# Get the command object to test
|
||||
self.cmd = container_image.UploadImage(self.app, None)
|
||||
|
||||
@mock.patch('sys.exit')
|
||||
@mock.patch('tripleo_common.image.image_uploader.ImageUploadManager',
|
||||
autospec=True)
|
||||
def test_container_image_upload_noargs(self, mock_manager):
|
||||
def test_container_image_upload_noargs(self, mock_manager, exit_mock):
|
||||
arglist = []
|
||||
verifylist = []
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_manager.assert_called_once_with([])
|
||||
mock_manager.return_value.upload.assert_called_once_with()
|
||||
# argparse will complain that --config-file is missing and exit with 2
|
||||
exit_mock.assert_called_with(2)
|
||||
|
||||
@mock.patch('tripleo_common.image.image_uploader.ImageUploadManager',
|
||||
autospec=True)
|
||||
@ -68,18 +68,19 @@ class TestContainerImageBuild(TestPluginV1):
|
||||
# Get the command object to test
|
||||
self.cmd = container_image.BuildImage(self.app, None)
|
||||
|
||||
@mock.patch('sys.exit')
|
||||
@mock.patch('tripleo_common.image.kolla_builder.KollaImageBuilder',
|
||||
autospec=True)
|
||||
def test_container_image_build_noargs(self, mock_builder):
|
||||
def test_container_image_build_noargs(self, mock_builder, exit_mock):
|
||||
arglist = []
|
||||
verifylist = []
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
mock_builder.assert_called_once_with([])
|
||||
mock_builder.return_value.build_images.assert_called_once_with([])
|
||||
# argparse will complain that --config-file and --kolla-config are
|
||||
# missing exit with 2
|
||||
exit_mock.assert_called_with(2)
|
||||
|
||||
@mock.patch('tripleo_common.image.kolla_builder.KollaImageBuilder',
|
||||
autospec=True)
|
||||
|
@ -36,6 +36,7 @@ class UploadImage(command.Command):
|
||||
metavar='<yaml config file>',
|
||||
default=[],
|
||||
action="append",
|
||||
required=True,
|
||||
help=_("YAML config file specifying the image build. May be "
|
||||
"specified multiple times. Order is preserved, and later "
|
||||
"files will override some options in previous files. "
|
||||
@ -64,6 +65,7 @@ class BuildImage(command.Command):
|
||||
metavar='<yaml config file>',
|
||||
default=[],
|
||||
action="append",
|
||||
required=True,
|
||||
help=_("YAML config file specifying the images to build. May be "
|
||||
"specified multiple times. Order is preserved, and later "
|
||||
"files will override some options in previous files. "
|
||||
@ -75,6 +77,7 @@ class BuildImage(command.Command):
|
||||
metavar='<config file>',
|
||||
default=[],
|
||||
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."),
|
||||
|
Loading…
Reference in New Issue
Block a user