From 64a8006d65498c4e780c6e48b6a5573aec3e03dd Mon Sep 17 00:00:00 2001 From: KaiFeng Wang Date: Thu, 7 Sep 2017 15:39:48 +0800 Subject: Remove deprecated OSC baremetal commands Following commands were deprecated one year ago, now we remove them from the tree: * openstack baremetal create * openstack baremetal delete * openstack baremetal list * openstack baremetal show * openstack baremetal set * openstack baremetal unset Note that `openstack baremetal create` is used to create a single node as well as create resources from file(s). Only the deprecated part (create a single node) is removed in this patch. Closes-Bug: #1715643 Change-Id: I0aed7cb970adf23db033c2a951026d649134caa9 --- ironicclient/osc/v1/baremetal_create.py | 55 ++++-------------------------- ironicclient/osc/v1/baremetal_node.py | 60 --------------------------------- 2 files changed, 7 insertions(+), 108 deletions(-) (limited to 'ironicclient/osc') diff --git a/ironicclient/osc/v1/baremetal_create.py b/ironicclient/osc/v1/baremetal_create.py index c16db10..5d23ddb 100644 --- a/ironicclient/osc/v1/baremetal_create.py +++ b/ironicclient/osc/v1/baremetal_create.py @@ -10,69 +10,28 @@ # License for the specific language governing permissions and limitations # under the License. -import argparse import logging +from osc_lib.command import command + from ironicclient.common.i18n import _ -from ironicclient import exc -from ironicclient.osc.v1 import baremetal_node from ironicclient.v1 import create_resources -class CreateBaremetal(baremetal_node.CreateBaremetalNode): - """Create resources from files or Register a new node (DEPRECATED). - - Create resources from files (by only specifying the files) or register - a new node by specifying one or more optional arguments (DEPRECATED, - use 'openstack baremetal node create' instead). - """ +class CreateBaremetal(command.Command): + """Create resources from files""" log = logging.getLogger(__name__ + ".CreateBaremetal") - def get_description(self): - return _("Create resources from files (by only specifying the files) " - "or register a new node by specifying one or more optional " - "arguments (DEPRECATED, use 'openstack baremetal node " - "create' instead)") - - # TODO(vdrok): Remove support for new node creation after 11-July-2017 - # during the 'Queens' cycle. def get_parser(self, prog_name): parser = super(CreateBaremetal, self).get_parser(prog_name) - # NOTE(vdrok): It is a workaround to allow --driver to be optional for - # openstack create command while creation of nodes via this command is - # not removed completely - parser = argparse.ArgumentParser(parents=[parser], - conflict_handler='resolve', - description=self.__doc__) - parser.add_argument( - '--driver', - metavar='', - help=_('Specify this and any other optional arguments if you want ' - 'to create a node only. Note that this is deprecated; ' - 'please use "openstack baremetal node create" instead.')) + parser.add_argument( - "resource_files", metavar="", default=[], nargs="*", + "resource_files", metavar="", nargs="+", help=_("File (.yaml or .json) containing descriptions of the " - "resources to create. Can be specified multiple times. If " - "you want to create resources, only specify the files. Do " - "not specify any of the optional arguments.")) + "resources to create. Can be specified multiple times.")) return parser def take_action(self, parsed_args): - if parsed_args.driver: - self.log.warning("This command is deprecated. Instead, use " - "'openstack baremetal node create'.") - return super(CreateBaremetal, self).take_action(parsed_args) - if not parsed_args.resource_files: - raise exc.ValidationError(_( - "If --driver is not supplied to openstack create command, " - "it is considered that it will create ironic resources from " - "one or more .json or .yaml files, but no files provided.")) create_resources.create_resources(self.app.client_manager.baremetal, parsed_args.resource_files) - # NOTE(vdrok): CreateBaremetal is still inherited from ShowOne class, - # which requires the return value of the function to be of certain - # type, leave this workaround until creation of nodes is removed and - # then change it so that this inherits from command.Command - return tuple(), tuple() diff --git a/ironicclient/osc/v1/baremetal_node.py b/ironicclient/osc/v1/baremetal_node.py index 49e1e20..b3b5d38 100755 --- a/ironicclient/osc/v1/baremetal_node.py +++ b/ironicclient/osc/v1/baremetal_node.py @@ -470,18 +470,6 @@ class DeleteBaremetalNode(command.Command): raise exc.ClientException("\n".join(failures)) -class DeleteBaremetal(DeleteBaremetalNode): - """Unregister a baremetal node. DEPRECATED""" - - # TODO(thrash): Remove after 11-July-2017 during the 'Queens' cycle. - log = logging.getLogger(__name__ + ".DeleteBaremetal") - - def take_action(self, parsed_args): - self.log.warning("This command is deprecated. Instead, use " - "'openstack baremetal node delete'.") - super(DeleteBaremetal, self).take_action(parsed_args) - - class DeployBaremetalNode(ProvisionStateWithWait): """Set provision state of baremetal node to 'deploy'""" @@ -656,18 +644,6 @@ class ListBaremetalNode(command.Lister): 'Properties': oscutils.format_dict},) for s in data)) -class ListBaremetal(ListBaremetalNode): - """List baremetal nodes. DEPRECATED""" - - # TODO(thrash): Remove after 11-July-2017 during the 'Queens' cycle. - log = logging.getLogger(__name__ + ".ListBaremetal") - - def take_action(self, parsed_args): - self.log.warning("This command is deprecated. Instead, use " - "'openstack baremetal node list'.") - return super(ListBaremetal, self).take_action(parsed_args) - - class MaintenanceSetBaremetalNode(command.Command): """Set baremetal node to maintenance mode""" @@ -1157,18 +1133,6 @@ class SetBaremetalNode(command.Command): self.log.warning("Please specify what to set.") -class SetBaremetal(SetBaremetalNode): - """Set baremetal properties. DEPRECATED""" - - # TODO(thrash): Remove after 11-July-2017 during the 'Queens' cycle. - log = logging.getLogger(__name__ + ".SetBaremetal") - - def take_action(self, parsed_args): - self.log.warning("This command is deprecated. Instead, use " - "'openstack baremetal node set'.") - return super(SetBaremetal, self).take_action(parsed_args) - - class ShowBaremetalNode(command.ShowOne): """Show baremetal node details""" @@ -1223,18 +1187,6 @@ class ShowBaremetalNode(command.ShowOne): return self.dict2columns(node) -class ShowBaremetal(ShowBaremetalNode): - """Show baremetal node details. DEPRECATED""" - - # TODO(thrash): Remove after 11-July-2017 during the 'Queens' cycle. - log = logging.getLogger(__name__ + ".ShowBaremetal") - - def take_action(self, parsed_args): - self.log.warning("This command is deprecated. Instead, use " - "'openstack baremetal node show'.") - return super(ShowBaremetal, self).take_action(parsed_args) - - class UndeployBaremetalNode(ProvisionStateWithWait): """Set provision state of baremetal node to 'deleted'""" @@ -1448,18 +1400,6 @@ class UnsetBaremetalNode(command.Command): self.log.warning("Please specify what to unset.") -class UnsetBaremetal(UnsetBaremetalNode): - """Unset baremetal properties. DEPRECATED""" - - # TODO(thrash): Remove after 11-July-2017 during the 'Queens' cycle. - log = logging.getLogger(__name__ + ".UnsetBaremetal") - - def take_action(self, parsed_args): - self.log.warning("This command is deprecated. Instead, use " - "'openstack baremetal node unset'.") - super(UnsetBaremetal, self).take_action(parsed_args) - - class ValidateBaremetalNode(command.Lister): """Validate a node's driver interfaces""" -- cgit v1.2.1