Allows multiple deletions
Allows deletion of multiples resources in the same command. Change-Id: I307cb515b0db45f1abc61521610fc4e6617597bb
This commit is contained in:
parent
e3f64c0055
commit
113ce00529
@ -66,13 +66,18 @@ def do_chassis_create(cc, args):
|
|||||||
utils.print_dict(data, wrap=72)
|
utils.print_dict(data, wrap=72)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('chassis', metavar='<chassis id>', help="ID of chassis")
|
@utils.arg('chassis',
|
||||||
|
metavar='<chassis id>',
|
||||||
|
nargs='+',
|
||||||
|
help="ID of chassis")
|
||||||
def do_chassis_delete(cc, args):
|
def do_chassis_delete(cc, args):
|
||||||
"""Delete a chassis."""
|
"""Delete a chassis."""
|
||||||
|
for c in args.chassis:
|
||||||
try:
|
try:
|
||||||
cc.chassis.delete(args.chassis)
|
cc.chassis.delete(c)
|
||||||
except exc.HTTPNotFound:
|
except exc.HTTPNotFound:
|
||||||
raise exc.CommandError('Chassis not found: %s' % args.chassis)
|
raise exc.CommandError('Chassis not found: %s' % c)
|
||||||
|
print 'Deleted chassis %s' % c
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('chassis',
|
@utils.arg('chassis',
|
||||||
|
@ -86,13 +86,18 @@ def do_node_create(cc, args):
|
|||||||
utils.print_dict(data, wrap=72)
|
utils.print_dict(data, wrap=72)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('node', metavar='<node id>', help="ID of node")
|
@utils.arg('node',
|
||||||
|
metavar='<node id>',
|
||||||
|
nargs='+',
|
||||||
|
help="ID of node")
|
||||||
def do_node_delete(cc, args):
|
def do_node_delete(cc, args):
|
||||||
"""Delete a node."""
|
"""Delete a node."""
|
||||||
|
for n in args.node:
|
||||||
try:
|
try:
|
||||||
cc.node.delete(args.node)
|
cc.node.delete(n)
|
||||||
except exc.HTTPNotFound:
|
except exc.HTTPNotFound:
|
||||||
raise exc.CommandError('Node not found: %s' % args.node)
|
raise exc.CommandError('Node not found: %s' % n)
|
||||||
|
print 'Deleted node %s' % n
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('node',
|
@utils.arg('node',
|
||||||
|
@ -69,13 +69,18 @@ def do_port_create(cc, args):
|
|||||||
utils.print_dict(data, wrap=72)
|
utils.print_dict(data, wrap=72)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('port', metavar='<port id>', help="ID of port")
|
@utils.arg('port',
|
||||||
|
metavar='<port id>',
|
||||||
|
nargs='+',
|
||||||
|
help="ID of port")
|
||||||
def do_port_delete(cc, args):
|
def do_port_delete(cc, args):
|
||||||
"""Delete a port."""
|
"""Delete a port."""
|
||||||
|
for p in args.port:
|
||||||
try:
|
try:
|
||||||
cc.port.delete(args.port)
|
cc.port.delete(p)
|
||||||
except exc.HTTPNotFound:
|
except exc.HTTPNotFound:
|
||||||
raise exc.CommandError('Port not found: %s' % args.port)
|
raise exc.CommandError('Port not found: %s' % p)
|
||||||
|
print 'Deleted port %s' % p
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('port',
|
@utils.arg('port',
|
||||||
|
Loading…
Reference in New Issue
Block a user