Help is displayed for deprecated commands
Deprecated commands in dcmanager are not allowed to execute when requested, but their help was displayed. In this commit, the dcmanager help <command> is disabled for subcloud reinstall, subcloud-deploy show, subcloud-deploy upload, subcloud reconfig and subcloud restore. Test plan: 1. PASS: Run dcmanager help <command> displays the relevant deprecation message 2. PASS: Run dcmanager <command> displays the relevant deprecation message and does not execute Closes-Bug: 2064294 Change-Id: I2cbe4b79d83b157413fd46337f4437f0a27717f6 Signed-off-by: Raphael Lima <Raphael.Lima@windriver.com>
This commit is contained in:
parent
622b38f552
commit
c0e71d2c08
|
@ -164,22 +164,34 @@ class SubcloudDeployShow(base.DCManagerShowOne):
|
|||
|
||||
|
||||
class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
|
||||
def _get_resources(self, parsed_args):
|
||||
def _raise_deprecation_message(self):
|
||||
deprecation_msg = (
|
||||
"This command has been deprecated. Please use "
|
||||
"subcloud deploy show instead."
|
||||
)
|
||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
||||
|
||||
def get_parser(self, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
def _get_resources(self, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
|
||||
class DeprecatedSubcloudDeployUpload(SubcloudDeployUpload):
|
||||
def _get_resources(self, parsed_args):
|
||||
def _raise_deprecation_message(self):
|
||||
deprecation_msg = (
|
||||
"This command has been deprecated. Please use "
|
||||
"subcloud deploy upload instead."
|
||||
)
|
||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
||||
|
||||
def get_parser(self, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
def _get_resources(self, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
|
||||
class SubcloudDeployDelete(command.Command):
|
||||
"""Delete the uploaded subcloud deployment files"""
|
||||
|
|
|
@ -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(self):
|
||||
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, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
def _get_resources(self, _):
|
||||
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(self):
|
||||
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, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
def _get_resources(self, _):
|
||||
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(self):
|
||||
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, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
def _get_resources(self, _):
|
||||
self._raise_deprecation_message()
|
||||
|
||||
|
||||
class PrestageSubcloud(base.DCManagerShowOne):
|
||||
"""Prestage a subcloud."""
|
||||
|
|
Loading…
Reference in New Issue