Merge "Enable "openstack server unlock" command to take multiple servers."

This commit is contained in:
Jenkins 2015-11-17 02:26:15 +00:00 committed by Gerrit Code Review
commit 74d53cdd50
3 changed files with 12 additions and 10 deletions

View File

@ -643,17 +643,17 @@ Suspend server
server unlock
-------------
Unlock server
Unlock server(s)
.. program:: server unlock
.. code:: bash
os server unlock
<server>
<server> [<server> ...]
.. describe:: <server>
Server (name or ID)
Server(s) to unlock (name or ID)
server unpause
--------------

View File

@ -186,7 +186,7 @@ Those actions with an opposite action are noted in parens if applicable.
* ``start`` (``stop``) - start one or more servers
* ``stop`` (``start``) - stop one or more servers
* ``suspend`` (``resume``) - stop a server and save to disk freeing memory
* ``unlock`` (``lock``) - unlock a server
* ``unlock`` (``lock``) - unlock one or more servers
* ``unpause`` (``pause``) - return one or more paused servers to running state
* ``unrescue`` (``rescue``) - return a server to normal boot mode
* ``unset`` (``set``) - remove an attribute of the object

View File

@ -1609,7 +1609,7 @@ class SuspendServer(command.Command):
class UnlockServer(command.Command):
"""Unlock server"""
"""Unlock server(s)"""
log = logging.getLogger(__name__ + '.UnlockServer')
@ -1618,7 +1618,8 @@ class UnlockServer(command.Command):
parser.add_argument(
'server',
metavar='<server>',
help=_('Server (name or ID)'),
nargs='+',
help=_('Server(s) to unlock (name or ID)'),
)
return parser
@ -1626,10 +1627,11 @@ class UnlockServer(command.Command):
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
utils.find_resource(
compute_client.servers,
parsed_args.server,
).unlock()
for server in parsed_args.server:
utils.find_resource(
compute_client.servers,
server,
).unlock()
class UnpauseServer(command.Command):