Fix dcmanager complete execution
The implementation [1] to deprecate commands in dcmanager's client raised an exception when dcmanager help <command> was executed which happened to break the dcmanager complete command used during bootstrap. This fix solves the issue and adds the deprecation message as a notice in the relevant commands. [1]: https://review.opendev.org/c/starlingx/distcloud-client/+/917493 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 3. PASS: Run dcmanager complete command Closes-Bug: 2064677 Change-Id: Icbe6e6f5e8145bb786d4b6aebb804416959cbb67 Signed-off-by: Raphael Lima <Raphael.Lima@windriver.com>
This commit is contained in:
parent
b4a8ec19dc
commit
1c18f13bca
|
@ -164,33 +164,33 @@ class SubcloudDeployShow(base.DCManagerShowOne):
|
||||||
|
|
||||||
|
|
||||||
class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
|
class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
|
||||||
def _raise_deprecation_message(self):
|
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
||||||
deprecation_msg = (
|
"subcloud deploy show instead.")
|
||||||
"This command has been deprecated. Please use "
|
|
||||||
"subcloud deploy show instead."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
|
||||||
|
|
||||||
def get_parser(self, _):
|
def get_parser(self, prog_name):
|
||||||
self._raise_deprecation_message()
|
parser = super().get_parser(prog_name)
|
||||||
|
parser.add_argument_group(
|
||||||
|
title="Notice", description=self.DEPRECATION_MESSAGE
|
||||||
|
)
|
||||||
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, _):
|
def _get_resources(self, _):
|
||||||
self._raise_deprecation_message()
|
raise exceptions.DCManagerClientException(self.DEPRECATION_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
class DeprecatedSubcloudDeployUpload(SubcloudDeployUpload):
|
class DeprecatedSubcloudDeployUpload(SubcloudDeployUpload):
|
||||||
def _raise_deprecation_message(self):
|
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
||||||
deprecation_msg = (
|
"subcloud deploy upload instead.")
|
||||||
"This command has been deprecated. Please use "
|
|
||||||
"subcloud deploy upload instead."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
|
||||||
|
|
||||||
def get_parser(self, _):
|
def get_parser(self, prog_name):
|
||||||
self._raise_deprecation_message()
|
parser = super().get_parser(prog_name)
|
||||||
|
parser.add_argument_group(
|
||||||
|
title="Notice", description=self.DEPRECATION_MESSAGE
|
||||||
|
)
|
||||||
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, _):
|
def _get_resources(self, _):
|
||||||
self._raise_deprecation_message()
|
raise exceptions.DCManagerClientException(self.DEPRECATION_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
class SubcloudDeployDelete(command.Command):
|
class SubcloudDeployDelete(command.Command):
|
||||||
|
|
|
@ -750,41 +750,41 @@ class UpdateSubcloud(base.DCManagerShowOne):
|
||||||
class ReconfigSubcloud(base.DCManagerShowOne):
|
class ReconfigSubcloud(base.DCManagerShowOne):
|
||||||
"""Reconfigure a subcloud."""
|
"""Reconfigure a subcloud."""
|
||||||
|
|
||||||
def _raise_deprecation_message(self):
|
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
||||||
deprecation_msg = (
|
"'subcloud deploy config' instead.")
|
||||||
"This command has been deprecated. Please use "
|
|
||||||
"'subcloud deploy config' instead."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
|
||||||
|
|
||||||
def _get_format_function(self):
|
def _get_format_function(self):
|
||||||
return detail_format
|
return detail_format
|
||||||
|
|
||||||
def get_parser(self, _):
|
def get_parser(self, prog_name):
|
||||||
self._raise_deprecation_message()
|
parser = super().get_parser(prog_name)
|
||||||
|
parser.add_argument_group(
|
||||||
|
title="Notice", description=self.DEPRECATION_MESSAGE
|
||||||
|
)
|
||||||
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, _):
|
def _get_resources(self, parsed_args):
|
||||||
self._raise_deprecation_message()
|
raise exceptions.DCManagerClientException(self.DEPRECATION_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
class ReinstallSubcloud(base.DCManagerShowOne):
|
class ReinstallSubcloud(base.DCManagerShowOne):
|
||||||
"""Reinstall a subcloud."""
|
"""Reinstall a subcloud."""
|
||||||
|
|
||||||
def _raise_deprecation_message(self):
|
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
||||||
deprecation_msg = (
|
"'subcloud redeploy' instead.")
|
||||||
"This command has been deprecated. Please use "
|
|
||||||
"'subcloud redeploy' instead."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
|
||||||
|
|
||||||
def _get_format_function(self):
|
def _get_format_function(self):
|
||||||
return detail_format
|
return detail_format
|
||||||
|
|
||||||
def get_parser(self, _):
|
def get_parser(self, prog_name):
|
||||||
self._raise_deprecation_message()
|
parser = super().get_parser(prog_name)
|
||||||
|
parser.add_argument_group(
|
||||||
|
title="Notice", description=self.DEPRECATION_MESSAGE
|
||||||
|
)
|
||||||
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, _):
|
def _get_resources(self, parsed_args):
|
||||||
self._raise_deprecation_message()
|
raise exceptions.DCManagerClientException(self.DEPRECATION_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
class RedeploySubcloud(base.DCManagerShowOne):
|
class RedeploySubcloud(base.DCManagerShowOne):
|
||||||
|
@ -925,21 +925,47 @@ class RedeploySubcloud(base.DCManagerShowOne):
|
||||||
class RestoreSubcloud(base.DCManagerShowOne):
|
class RestoreSubcloud(base.DCManagerShowOne):
|
||||||
"""Restore a subcloud."""
|
"""Restore a subcloud."""
|
||||||
|
|
||||||
def _raise_deprecation_message(self):
|
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
||||||
deprecation_msg = (
|
"subcloud-backup restore instead.")
|
||||||
"This command has been deprecated. Please use "
|
|
||||||
"subcloud-backup restore instead."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(deprecation_msg)
|
|
||||||
|
|
||||||
def _get_format_function(self):
|
def _get_format_function(self):
|
||||||
return detail_format
|
return detail_format
|
||||||
|
|
||||||
def get_parser(self, _):
|
def get_parser(self, prog_name):
|
||||||
self._raise_deprecation_message()
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
def _get_resources(self, _):
|
parser.add_argument(
|
||||||
self._raise_deprecation_message()
|
"--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.")
|
||||||
|
|
||||||
|
parser.add_argument_group(
|
||||||
|
title="Notice", description=self.DEPRECATION_MESSAGE
|
||||||
|
)
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def _get_resources(self, parsed_args):
|
||||||
|
raise exceptions.DCManagerClientException(self.DEPRECATION_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
class PrestageSubcloud(base.DCManagerShowOne):
|
class PrestageSubcloud(base.DCManagerShowOne):
|
||||||
|
|
Loading…
Reference in New Issue