Commit 7b3a2fa3 authored by Giorgos Verigakis's avatar Giorgos Verigakis
Browse files

Add a purge command

parent 49919699
......@@ -712,8 +712,7 @@ class store_create(_store_account_command):
"""Create a container"""
def main(self, container):
if self.options.account:
self.client.account = self.options.account
super(store_create, self).main()
self.client.create_container(container)
......@@ -722,8 +721,7 @@ class store_container(_store_account_command):
"""Get container info"""
def main(self, container):
if self.options.account:
self.client.account = self.options.account
super(store_container, self).main()
reply = self.client.get_container_meta(container)
print_dict(reply)
......@@ -801,6 +799,15 @@ class store_delete(_store_container_command):
self.client.delete_object(path)
@command(api='storage')
class store_purge(_store_account_command):
"""Purge a container"""
def main(self, container):
super(store_purge, self).main()
self.client.purge_container(container)
@command(api='astakos')
class astakos_authenticate(object):
"""Authenticate a user"""
......
......@@ -34,6 +34,8 @@
import hashlib
import os
from time import time
from ..utils import OrderedDict
from .storage import StorageClient
......@@ -47,7 +49,14 @@ def pithos_hash(block, blockhash):
class PithosClient(StorageClient):
"""GRNet Pithos API client"""
def purge_container(self, container):
self.assert_account()
path = '/%s/%s' % (self.account, container)
params = {'until': int(time())}
self.delete(path, params=params, success=204)
def put_block(self, data, hash):
path = '/%s/%s' % (self.account, self.container)
params = {'update': ''}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment