yash's first commit added delete selected command
This commit is contained in:
parent
f6528f8f06
commit
0d05a2e55e
@ -30,7 +30,7 @@ libcloud.security.CA_CERTS_PATH = ['./root-ca.crt']
|
||||
# Please use 1-29 for 0 in the following variable to specify your group number.
|
||||
# (will be used for the username, project etc., as coordinated in the lab sessions)
|
||||
|
||||
GROUP_NUMBER = 0
|
||||
GROUP_NUMBER = 2
|
||||
|
||||
|
||||
|
||||
|
@ -181,7 +181,16 @@ def do_delete_all():
|
||||
|
||||
CONF.command.uuid = uuid
|
||||
do_delete_fractal()
|
||||
|
||||
def do_delete_slected_fractal():
|
||||
LOG.info("deleting given fractals %s" % CONF.command.uuid)
|
||||
raw_list= CONF.command.uuid.split(",")
|
||||
for uuid in raw_list:
|
||||
headers = {'Content-Type': 'application/vnd.api+json',
|
||||
'Accept': 'application/vnd.api+json'}
|
||||
result = requests.delete("%s/v1/fractal/%s" %
|
||||
(CONF.endpoint_url, uuid),
|
||||
headers=headers)
|
||||
LOG.debug("result: %s" % result.text)
|
||||
|
||||
def do_create_fractal():
|
||||
random.seed()
|
||||
@ -257,9 +266,14 @@ def add_command_parsers(subparsers):
|
||||
parser.set_defaults(func=do_delete_fractal)
|
||||
parser.add_argument("uuid", help="Fractal to delete.")
|
||||
|
||||
## no arguments
|
||||
parser = subparsers.add_parser('delete-all')
|
||||
parser.set_defaults(func=do_delete_all)
|
||||
## no arguments
|
||||
|
||||
## it takes a list of uuids separated by commas
|
||||
parser = subparsers.add_parser('delete-selected')
|
||||
parser.set_defaults(func=do_delete_slected_fractal)
|
||||
parser.add_argument("uuid", help="deleting the selected fractals.")
|
||||
|
||||
parser = subparsers.add_parser('show')
|
||||
parser.set_defaults(func=do_show_fractal)
|
||||
|
Loading…
x
Reference in New Issue
Block a user