Rename options to the prepare command for clarity

Changed the following options:
* '--images-file' to '--output-images-file'
* '--env-file' to '--output-env-file'
* '--service-environment-file' to '--environment-file' in order to
  match the equivalent option of the deploy command.

The old options are still in place and show a Deprecation warning in
the help message.

Change-Id: I24a6021d19ffe74760f9897e9bf3453742939bc9
Closes-Bug: #1723157
This commit is contained in:
Martin André 2017-10-12 16:42:04 +01:00
parent d8e2ad2694
commit d2cc4c5489
3 changed files with 45 additions and 11 deletions

View File

@ -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.

View File

@ -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,
]

View File

@ -242,13 +242,30 @@ class PrepareImageFiles(command.Command):
)
parser.add_argument(
"--images-file",
dest="images_file",
dest="output_images_file",
metavar='<file path>',
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='<file path>',
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='<file path>',
'--service-environment-file', metavar='<file path>',
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='<file path>',
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='<file path>',
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='<file path>',
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)