Commit 60560d7c authored by Giorgos Verigakis's avatar Giorgos Verigakis
Browse files

Add a store create command to create a container

parent 53129af9
......@@ -637,10 +637,10 @@ class store_command(object):
@classmethod
def update_parser(cls, parser):
parser.add_option('--account', dest='account', metavar='ACCOUNT',
help='use account ACCOUNT')
parser.add_option('--container', dest='container', metavar='CONTAINER',
help='use container CONTAINER')
parser.add_option('--account', dest='account', metavar='NAME',
help='use account NAME')
parser.add_option('--container', dest='container', metavar='NAME',
help='use container NAME')
def main(self):
self.config.override('storage_account', self.options.account)
......@@ -651,6 +651,20 @@ class store_command(object):
self.client = clients.PithosClient(self.config)
@command(api='storage')
class store_create(object):
"""create a container"""
@classmethod
def update_parser(cls, parser):
parser.add_option('--account', dest='account', metavar='ACCOUNT',
help='use account ACCOUNT')
def main(self, container):
self.config.override('storage_account', self.options.account)
self.client.create_container(container)
@command(api='storage')
class store_container(store_command):
"""get container info"""
......
......@@ -66,6 +66,10 @@ class StorageClient(HTTPClient):
raise ClientError('No container was given')
return container
def create_container(self, container):
path = '/%s/%s' % (self.account, container)
self.http_put(path, success=201)
def get_container_meta(self):
path = '/%s/%s' % (self.account, self.container)
resp, reply = self.raw_http_cmd('HEAD', path, success=204)
......
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