[WIP] Add deprecation notice in help for deprecated commands

Change-Id: I2cbe4b79d83b157413fd46337f4437f0a27717f6
Signed-off-by: Raphael Lima <Raphael.Lima@windriver.com>
This commit is contained in:
Raphael Lima 2024-04-29 18:13:57 -03:00
parent 622b38f552
commit ec8b638539
2 changed files with 44 additions and 43 deletions

View File

@ -164,22 +164,34 @@ class SubcloudDeployShow(base.DCManagerShowOne):
class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
def _get_resources(self, parsed_args):
def _raise_deprecation_message():
deprecation_msg = (
"This command has been deprecated. Please use "
"subcloud deploy show instead."
)
raise exceptions.DCManagerClientException(deprecation_msg)
def get_parser(self, prog_name):
self._raise_deprecation_message()
def _get_resources(self, parsed_args):
self._raise_deprecation_message()
class DeprecatedSubcloudDeployUpload(SubcloudDeployUpload):
def _get_resources(self, parsed_args):
def _raise_deprecation_message():
deprecation_msg = (
"This command has been deprecated. Please use "
"subcloud deploy upload instead."
)
raise exceptions.DCManagerClientException(deprecation_msg)
def get_parser(self, prog_name):
self._raise_deprecation_message()
def _get_resources(self, parsed_args):
self._raise_deprecation_message()
class SubcloudDeployDelete(command.Command):
"""Delete the uploaded subcloud deployment files"""

View File

@ -750,30 +750,42 @@ class UpdateSubcloud(base.DCManagerShowOne):
class ReconfigSubcloud(base.DCManagerShowOne):
"""Reconfigure a subcloud."""
def _get_format_function(self):
return detail_format
def _get_resources(self, parsed_args):
def _raise_deprecation_message():
deprecation_msg = (
"This command has been deprecated. Please use "
"'subcloud deploy config' instead."
)
raise exceptions.DCManagerClientException(deprecation_msg)
def _get_format_function(self):
return detail_format
def get_parser(self, prog_name):
self._raise_deprecation_message()
def _get_resources(self, parsed_args):
self._raise_deprecation_message()
class ReinstallSubcloud(base.DCManagerShowOne):
"""Reinstall a subcloud."""
def _get_format_function(self):
return detail_format
def _get_resources(self, parsed_args):
def _raise_deprecation_message():
deprecation_msg = (
"This command has been deprecated. Please use "
"'subcloud redeploy' instead."
)
raise exceptions.DCManagerClientException(deprecation_msg)
def _get_format_function(self):
return detail_format
def get_parser(self, prog_name):
self._raise_deprecation_message()
def _get_resources(self, parsed_args):
self._raise_deprecation_message()
class RedeploySubcloud(base.DCManagerShowOne):
"""Redeploy a subcloud."""
@ -913,45 +925,22 @@ class RedeploySubcloud(base.DCManagerShowOne):
class RestoreSubcloud(base.DCManagerShowOne):
"""Restore a subcloud."""
def _get_format_function(self):
return detail_format
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument(
"--restore-values",
required=False,
help="YAML file containing subcloud restore settings. "
"Can be either a local file path or a URL.",
)
parser.add_argument(
"--sysadmin-password",
required=False,
help="sysadmin password of the subcloud to be restored, "
"if not provided you will be prompted.",
)
parser.add_argument(
"--with-install",
required=False,
action="store_true",
help="option to reinstall the subcloud as part of restore, "
"suitable only for subclouds that can be installed remotely.",
)
parser.add_argument("subcloud", help="Name or ID of the subcloud to update.")
return parser
def _get_resources(self, parsed_args):
def _raise_deprecation_message():
deprecation_msg = (
"This command has been deprecated. Please use "
"subcloud-backup restore instead."
)
raise exceptions.DCManagerClientException(deprecation_msg)
def _get_format_function(self):
return detail_format
def get_parser(self, prog_name):
self._raise_deprecation_message()
def _get_resources(self, parsed_args):
self._raise_deprecation_message()
class PrestageSubcloud(base.DCManagerShowOne):
"""Prestage a subcloud."""