diff --git a/releasenotes/notes/rename-prepare-cmd-args-f867df198d53943b.yaml b/releasenotes/notes/rename-prepare-cmd-args-f867df198d53943b.yaml new file mode 100644 index 000000000..fc91e5d6a --- /dev/null +++ b/releasenotes/notes/rename-prepare-cmd-args-f867df198d53943b.yaml @@ -0,0 +1,9 @@ +--- +deprecations: + - | + Renamed some options to the `openstack overcloud container image prepare` + command for clarity. The '--images-file' option was renamed to + '--output-images-file'. The '--env-file' option was renamed to + '--output-env-file'. The '--service-environment-file' option was renamed + to '--environment-file'. The old options are still in place and show + a deprecation warning in the help message. diff --git a/tripleoclient/tests/v1/overcloud_image/test_container_image.py b/tripleoclient/tests/v1/overcloud_image/test_container_image.py index 534e9d5c4..c918dcf7f 100644 --- a/tripleoclient/tests/v1/overcloud_image/test_container_image.py +++ b/tripleoclient/tests/v1/overcloud_image/test_container_image.py @@ -163,9 +163,9 @@ class TestContainerImagePrepare(TestPluginV1): 'os-', '--suffix', 'foo', - '--images-file', + '--output-images-file', images_file, - '--env-file', + '--output-env-file', env_file, '--set', 'ceph_namespace=myceph', @@ -271,9 +271,9 @@ class TestContainerImagePrepare(TestPluginV1): 'os-', '--suffix', 'foo', - '--images-file', + '--output-images-file', images_file, - '--env-file', + '--output-env-file', env_file, ] diff --git a/tripleoclient/v1/container_image.py b/tripleoclient/v1/container_image.py index 5508b235b..94340fa85 100644 --- a/tripleoclient/v1/container_image.py +++ b/tripleoclient/v1/container_image.py @@ -242,13 +242,30 @@ class PrepareImageFiles(command.Command): ) parser.add_argument( "--images-file", - dest="images_file", + dest="output_images_file", + metavar='', + help=_("File to write resulting image entries to, as well as " + "stdout. Any existing file will be overwritten." + "(DEPRECATED. Use --output-images-file instead)"), + ) + parser.add_argument( + "--output-images-file", + dest="output_images_file", metavar='', help=_("File to write resulting image entries to, as well as " "stdout. Any existing file will be overwritten."), ) parser.add_argument( - '--service-environment-file', '-e', metavar='', + '--service-environment-file', metavar='', + action='append', dest='environment_files', + help=_('Environment files specifying which services are ' + 'containerized. Entries will be filtered to only contain ' + 'images used by containerized services. (Can be specified ' + 'more than once.)' + "(DEPRECATED. Use --environment-file instead)"), + ) + parser.add_argument( + '--environment-file', '-e', metavar='', action='append', dest='environment_files', help=_('Environment files specifying which services are ' 'containerized. Entries will be filtered to only contain ' @@ -257,7 +274,15 @@ class PrepareImageFiles(command.Command): ) parser.add_argument( "--env-file", - dest="env_file", + dest="output_env_file", + metavar='', + help=_("File to write heat environment file which specifies all " + "image parameters. Any existing file will be overwritten." + "(DEPRECATED. Use --output-env-file instead)"), + ) + parser.add_argument( + "--output-env-file", + dest="output_env_file", metavar='', help=_("File to write heat environment file which specifies all " "image parameters. Any existing file will be overwritten."), @@ -382,15 +407,15 @@ class PrepareImageFiles(command.Command): if 'services' in entry: del(entry['services']) - if parsed_args.env_file: - self.write_env_file(params, parsed_args.env_file) + if parsed_args.output_env_file: + self.write_env_file(params, parsed_args.output_env_file) result_str = yaml.safe_dump({'container_images': result}, default_flow_style=False) sys.stdout.write(result_str) - if parsed_args.images_file: - with os.fdopen(os.open(parsed_args.images_file, + if parsed_args.output_images_file: + with os.fdopen(os.open(parsed_args.output_images_file, os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o666), 'w') as f: f.write(result_str)