Revision e3fd7f91 tools/store
b/tools/store | ||
---|---|---|
57 | 57 |
|
58 | 58 |
self.parser = parser |
59 | 59 |
self.args = args |
60 |
|
|
60 |
|
|
61 | 61 |
def add_options(self, parser): |
62 | 62 |
pass |
63 | 63 |
|
... | ... | |
105 | 105 |
self.list_objects(container) |
106 | 106 |
else: |
107 | 107 |
self.list_containers() |
108 |
|
|
108 |
|
|
109 | 109 |
def list_containers(self): |
110 | 110 |
params = {'limit':self.limit, 'marker':self.marker} |
111 | 111 |
headers = {'IF_MODIFIED_SINCE':self.if_modified_since, |
... | ... | |
148 | 148 |
default=False, help='show metadata until that date') |
149 | 149 |
parser.add_option('--format', action='store', dest='format', |
150 | 150 |
default='%d/%m/%Y', help='format to parse until date') |
151 |
parser.add_option('--version', action='store', dest='version', |
|
152 |
default=None, help='show specific version \ |
|
153 |
(applies only for objects)') |
|
151 | 154 |
|
152 | 155 |
def execute(self, path=''): |
153 | 156 |
container, sep, object = path.partition('/') |
... | ... | |
263 | 266 |
dest='manifest', default=None, |
264 | 267 |
help='use for large file support') |
265 | 268 |
parser.add_option('--touch', action='store_true', |
266 |
dest='touch', default=True,
|
|
269 |
dest='touch', default=False,
|
|
267 | 270 |
help='create object with zero data') |
268 | 271 |
|
269 | 272 |
def execute(self, path, srcpath='-', *args): |
... | ... | |
334 | 337 |
@cli_command('update') |
335 | 338 |
class UpdateObject(Command): |
336 | 339 |
syntax = '<container>/<object> path [key=val] [...]' |
337 |
description = 'update object metadata/data' |
|
340 |
description = 'update object metadata/data (default mode: append)'
|
|
338 | 341 |
|
339 | 342 |
def add_options(self, parser): |
340 | 343 |
parser.add_option('-a', action='store_true', dest='append', |
341 |
default=None, help='append data')
|
|
344 |
default=True, help='append data')
|
|
342 | 345 |
parser.add_option('--start', action='store', |
343 | 346 |
dest='start', |
344 | 347 |
default=None, help='range of data to be updated') |
... | ... | |
356 | 359 |
dest='manifest', default=None, |
357 | 360 |
help='use for large file support') |
358 | 361 |
|
359 |
def execute(self, path, srcpath, *args): |
|
362 |
def execute(self, path, srcpath='-', *args):
|
|
360 | 363 |
headers = {} |
361 | 364 |
if self.manifest: |
362 | 365 |
headers['X_OBJECT_MANIFEST'] = self.manifest |
... | ... | |
451 | 454 |
|
452 | 455 |
try: |
453 | 456 |
cmd.execute(*cmd.args) |
454 |
except TypeError: |
|
457 |
except TypeError, e: |
|
458 |
print e |
|
455 | 459 |
cmd.parser.usage = '%%prog %s [options] %s' % (name, cmd.syntax) |
456 | 460 |
cmd.parser.print_help() |
457 | 461 |
exit(1) |
458 | 462 |
except Fault, f: |
459 |
print f.data |
|
463 |
print f.status, f.data
|
|
460 | 464 |
|
461 | 465 |
if __name__ == '__main__': |
462 | 466 |
main() |
Also available in: Unified diff