Client support for --force option
Change-Id: I90d3dd52cbe68de336a69e0f73d1d6b0bfeaadfd Partial-Bug: #1619775
This commit is contained in:
parent
592debaafd
commit
8aba477826
@ -132,7 +132,9 @@ class Manager(object):
|
||||
if body:
|
||||
return self.resource_class(self, body)
|
||||
|
||||
def _delete(self, url):
|
||||
def _delete(self, url, qparams=None):
|
||||
if qparams:
|
||||
url = "%s?%s" % (url, urlparse.urlencode(qparams))
|
||||
self.api.raw_request('DELETE', url)
|
||||
|
||||
|
||||
|
@ -100,8 +100,9 @@ class ContainerManager(base.Manager):
|
||||
"Key must be in %s" % ','.join(CREATION_ATTRIBUTES))
|
||||
return self._create(self._path(), new)
|
||||
|
||||
def delete(self, id):
|
||||
return self._delete(self._path(id))
|
||||
def delete(self, id, force):
|
||||
return self._delete(self._path(id),
|
||||
qparams={'force': force})
|
||||
|
||||
def _action(self, id, action, method='POST', qparams=None, **kwargs):
|
||||
if qparams:
|
||||
|
@ -84,11 +84,14 @@ def do_list(cs, args):
|
||||
metavar='<container>',
|
||||
nargs='+',
|
||||
help='ID or name of the (container)s to delete.')
|
||||
@utils.arg('--force',
|
||||
action='store_true',
|
||||
help='Force delete the container.')
|
||||
def do_delete(cs, args):
|
||||
"""Delete specified containers."""
|
||||
for container in args.containers:
|
||||
try:
|
||||
cs.containers.delete(container)
|
||||
cs.containers.delete(container, args.force)
|
||||
print("Request to delete container %s has been accepted." %
|
||||
container)
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user