From 5c76e54a1272ae69411303f9c7b1a110079b2df8 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 21 May 2018 16:22:30 +1200 Subject: [PATCH] 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 --- .../notes/prepare-include-86d96ff1d7bdc44d.yaml | 6 ++++++ tripleoclient/tests/v1/test_container_image.py | 2 ++ tripleoclient/v1/container_image.py | 12 ++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 releasenotes/notes/prepare-include-86d96ff1d7bdc44d.yaml 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,