Revision 93abb8b2 pithos/tools/pithos-sh
b/pithos/tools/pithos-sh | ||
---|---|---|
225 | 225 |
class CreateContainer(Command): |
226 | 226 |
syntax = '<container> [key=val] [...]' |
227 | 227 |
description = 'create a container' |
228 |
policy={} |
|
229 | 228 |
|
230 | 229 |
def add_options(self, parser): |
231 |
parser.add_option('--versioning', action='store', dest=policy['versioning'],
|
|
230 |
parser.add_option('--versioning', action='store', dest='versioning',
|
|
232 | 231 |
default=None, help='set container versioning (auto/none)') |
233 |
parser.add_option('--quota', action='store', dest=policy['quota'],
|
|
232 |
parser.add_option('--quota', action='store', dest='quota',
|
|
234 | 233 |
default=None, help='set default container quota') |
235 | 234 |
|
236 | 235 |
def execute(self, container, *args): |
... | ... | |
238 | 237 |
for arg in args: |
239 | 238 |
key, sep, val = arg.partition('=') |
240 | 239 |
meta[key] = val |
240 |
policy = {} |
|
241 |
if getattr(self, 'versioning'): |
|
242 |
policy['versioning'] = self.versioning |
|
243 |
if getattr(self, 'quota'): |
|
244 |
policy['quota'] = self.quota |
|
241 | 245 |
ret = self.client.create_container(container, meta=meta, policies=policy) |
242 | 246 |
if not ret: |
243 | 247 |
print 'Container already exists' |
Also available in: Unified diff