Add --include argument to old prepare command

So the old prepare command retains feature parity with the new one,
add an --include argument for the new include filtering.

Change-Id: I472202243fc9b95034e481761845755eb87dff34
Depends-On: I751670f3788898d78f261000c0f51049948e8544
This commit is contained in:
Steve Baker 2018-05-21 16:22:30 +12:00
parent 31688cb8c3
commit 5c76e54a12
3 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
features:
- |
The command `openstack overcloud container image prepare` command now has
an `--include` argument which will filter entries if they do not match any
of the include expressions.

View File

@ -127,6 +127,7 @@ class TestContainerImagePrepare(TestPluginV1):
mock_cip.assert_called_with(
excludes=[],
includes=[],
mapping_args={
'name_suffix': '',
'tag': 'latest',
@ -234,6 +235,7 @@ class TestContainerImagePrepare(TestPluginV1):
object_request=mock.ANY)
mock_cip.assert_called_once_with(
excludes=[],
includes=[],
mapping_args={
'namespace': '192.0.2.0:8787/t',
'name_suffix': 'foo',

View File

@ -273,6 +273,17 @@ class PrepareImageFiles(command.Command):
"exclude from the final output. Can be specified multiple "
"times."),
)
parser.add_argument(
"--include",
dest="includes",
metavar='<regex>',
default=[],
action="append",
help=_("Pattern to match against resulting imagename entries to "
"include in final output. Can be specified multiple "
"times, entries not matching any --include will be "
"excluded. --exclude is ignored if --include is used."),
)
parser.add_argument(
"--images-file",
dest="output_images_file",
@ -401,6 +412,7 @@ class PrepareImageFiles(command.Command):
prepare_data = kolla_builder.container_images_prepare(
excludes=parsed_args.excludes,
includes=parsed_args.includes,
service_filter=service_filter,
pull_source=parsed_args.pull_source,
push_destination=parsed_args.push_destination,