Merge "Add missing parameters on openstack server rescue"
This commit is contained in:
commit
d215982ce0
@ -1576,7 +1576,7 @@ class RemoveServerVolume(command.Command):
|
||||
)
|
||||
|
||||
|
||||
class RescueServer(command.ShowOne):
|
||||
class RescueServer(command.Command):
|
||||
_description = _("Put server in rescue mode")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
@ -1586,16 +1586,35 @@ class RescueServer(command.ShowOne):
|
||||
metavar='<server>',
|
||||
help=_('Server (name or ID)'),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--image',
|
||||
metavar='<image>',
|
||||
help=_('Image (name or ID) to use for the rescue mode.'
|
||||
' Defaults to the currently used one.'),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--password',
|
||||
metavar='<password>',
|
||||
help=_("Set the password on the rescued instance"),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
||||
compute_client = self.app.client_manager.compute
|
||||
_, body = utils.find_resource(
|
||||
image_client = self.app.client_manager.image
|
||||
|
||||
image = None
|
||||
if parsed_args.image:
|
||||
image = utils.find_resource(
|
||||
image_client.images,
|
||||
parsed_args.image,
|
||||
)
|
||||
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
parsed_args.server,
|
||||
).rescue()
|
||||
return zip(*sorted(six.iteritems(body)))
|
||||
).rescue(image=image,
|
||||
password=parsed_args.password)
|
||||
|
||||
|
||||
class ResizeServer(command.Command):
|
||||
|
@ -184,7 +184,18 @@ class ServerTests(common.ComputeTestCase):
|
||||
|
||||
# rescue
|
||||
raw_output = self.openstack('server rescue ' + name)
|
||||
self.assertNotEqual("", raw_output)
|
||||
self.assertEqual("", raw_output)
|
||||
self.wait_for_status(name, "RESCUE")
|
||||
|
||||
# unrescue
|
||||
raw_output = self.openstack('server unrescue ' + name)
|
||||
self.assertEqual("", raw_output)
|
||||
self.wait_for_status(name, "ACTIVE")
|
||||
|
||||
# rescue with image
|
||||
raw_output = self.openstack('server rescue --image ' +
|
||||
self.image_name + ' ' + name)
|
||||
self.assertEqual("", raw_output)
|
||||
self.wait_for_status(name, "RESCUE")
|
||||
|
||||
# unrescue
|
||||
|
5
releasenotes/notes/bug-1703278-5e45a92e43552dec.yaml
Normal file
5
releasenotes/notes/bug-1703278-5e45a92e43552dec.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Add ``--image`` and ``--password`` options to the ``server rescue`` command.
|
||||
[Bug `1703278 <https://bugs.launchpad.net/python-openstackclient/+bug/1703278>`_]
|
Loading…
Reference in New Issue
Block a user