Trivial: Do not use plural format in command parameter in "network delete"

Since "network delete" could delete more than one network,
add a (s) to the doc.

And also, rename the parameter "networks" to "network".
The naming style is not using plural format in parameter.

Change-Id: Id434ea905af34457f84ea6bcb18addef5800429a
This commit is contained in:
Tang Chen
2015-12-05 10:40:09 +08:00
parent f65f82e435
commit 2caf7b19e2
3 changed files with 5 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ Delete network(s)
.. _network_delete-project: .. _network_delete-project:
.. describe:: <network> .. describe:: <network>
Network to delete (name or ID) Network(s) to delete (name or ID)
network list network list
------------ ------------

View File

@@ -119,17 +119,17 @@ class DeleteNetwork(command.Command):
def get_parser(self, prog_name): def get_parser(self, prog_name):
parser = super(DeleteNetwork, self).get_parser(prog_name) parser = super(DeleteNetwork, self).get_parser(prog_name)
parser.add_argument( parser.add_argument(
'networks', 'network',
metavar="<network>", metavar="<network>",
nargs="+", nargs="+",
help=("Network to delete (name or ID)") help=("Network(s) to delete (name or ID)")
) )
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args) self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network client = self.app.client_manager.network
for network in parsed_args.networks: for network in parsed_args.network:
obj = client.find_network(network) obj = client.find_network(network)
client.delete_network(obj) client.delete_network(obj)
return return

View File

@@ -284,7 +284,7 @@ class TestDeleteNetwork(TestNetwork):
self._network.name, self._network.name,
] ]
verifylist = [ verifylist = [
('networks', [self._network.name]), ('network', [self._network.name]),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)