diff --git a/releasenotes/notes/prepare-include-86d96ff1d7bdc44d.yaml b/releasenotes/notes/prepare-include-86d96ff1d7bdc44d.yaml new file mode 100644 index 000000000..b101ffa54 --- /dev/null +++ b/releasenotes/notes/prepare-include-86d96ff1d7bdc44d.yaml @@ -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. diff --git a/tripleoclient/tests/v1/test_container_image.py b/tripleoclient/tests/v1/test_container_image.py index 9a299c4b7..a989e60cc 100644 --- a/tripleoclient/tests/v1/test_container_image.py +++ b/tripleoclient/tests/v1/test_container_image.py @@ -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', diff --git a/tripleoclient/v1/container_image.py b/tripleoclient/v1/container_image.py index 5028f7c75..5e20290bf 100644 --- a/tripleoclient/v1/container_image.py +++ b/tripleoclient/v1/container_image.py @@ -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='', + 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,