Revision eb647cfe kamaki/cli/commands/pithos.py
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
377 | 377 |
if self['publish'] and self['unpublish']: |
378 | 378 |
raise CLIInvalidArgument( |
379 | 379 |
'Arguments %s and %s cannot be used together' % ( |
380 |
'/'.join(self.arguments['publish'].parsed_name),
|
|
381 |
'/'.join(self.arguments['publish'].parsed_name)))
|
|
380 |
self.arguments['publish'].lvalue,
|
|
381 |
self.arguments['publish'].lvalue))
|
|
382 | 382 |
if self['no_permissions'] and ( |
383 | 383 |
self['uuid_for_read_permission'] or self[ |
384 | 384 |
'uuid_for_write_permission']): |
385 | 385 |
raise CLIInvalidArgument( |
386 |
'%s cannot be used with other permission arguments' % '/'.join(
|
|
387 |
self.arguments['no_permissions'].parsed_name))
|
|
386 |
'%s cannot be used with other permission arguments' % ( |
|
387 |
self.arguments['no_permissions'].lvalue))
|
|
388 | 388 |
self._run() |
389 | 389 |
|
390 | 390 |
|
... | ... | |
555 | 555 |
self.dst_client.account, |
556 | 556 |
self.dst_client.container, |
557 | 557 |
dst_path), |
558 |
'Use %s to transfer overwrite' % ('/'.join(
|
|
559 |
self.arguments['force'].parsed_name))])
|
|
558 |
'Use %s to transfer overwrite' % ( |
|
559 |
self.arguments['force'].lvalue)])
|
|
560 | 560 |
else: |
561 | 561 |
# One object transfer |
562 | 562 |
try: |
... | ... | |
570 | 570 |
'Missing specific path container %s' % self.container, |
571 | 571 |
importance=2, details=[ |
572 | 572 |
'To transfer container contents %s' % ( |
573 |
'/'.join(self.arguments[ |
|
574 |
'source_prefix'].parsed_name))]) |
|
573 |
self.arguments['source_prefix'].lvalue)]) |
|
575 | 574 |
raise |
576 | 575 |
dst_path = self.dst_path or self.path |
577 | 576 |
dst_obj = dst_objects.get(dst_path or self.path, None) |
... | ... | |
589 | 588 |
self.container, |
590 | 589 |
self.path), |
591 | 590 |
'To recursively copy a directory, use', |
592 |
' %s' % ('/'.join( |
|
593 |
self.arguments['source_prefix'].parsed_name)), |
|
591 |
' %s' % self.arguments['source_prefix'].lvalue, |
|
594 | 592 |
'To create a file, use', |
595 | 593 |
' /file create (general purpose)', |
596 | 594 |
' /file mkdir (a directory object)']) |
... | ... | |
607 | 605 |
self.dst_client.account, |
608 | 606 |
self.dst_client.container, |
609 | 607 |
dst_path), |
610 |
'Use %s to transfer overwrite' % ('/'.join(
|
|
611 |
self.arguments['force'].parsed_name))])
|
|
608 |
'Use %s to transfer overwrite' % ( |
|
609 |
self.arguments['force'].lvalue)])
|
|
612 | 610 |
return pairs |
613 | 611 |
|
614 | 612 |
def _run(self, source_path_or_url, destination_path_or_url=''): |
... | ... | |
873 | 871 |
if path.isdir(lpath): |
874 | 872 |
if not self['recursive']: |
875 | 873 |
raise CLIError('%s is a directory' % lpath, details=[ |
876 |
'Use %s to upload directories & contents' % '/'.join(
|
|
877 |
self.arguments['recursive'].parsed_name)])
|
|
874 |
'Use %s to upload directories & contents' % ( |
|
875 |
self.arguments['recursive'].lvalue)])
|
|
878 | 876 |
robj = self.client.container_get(path=rpath) |
879 | 877 |
if not self['overwrite']: |
880 | 878 |
if robj.json: |
... | ... | |
1174 | 1172 |
elif path.exists(lpath): |
1175 | 1173 |
raise CLIError( |
1176 | 1174 |
'Cannot overwrite %s' % lpath, |
1177 |
details=['To overwrite/resume, use %s' % '/'.join(
|
|
1178 |
self.arguments['resume'].parsed_name)])
|
|
1175 |
details=['To overwrite/resume, use %s' % ( |
|
1176 |
self.arguments['resume'].lvalue)])
|
|
1179 | 1177 |
else: |
1180 | 1178 |
ret.append((opath, lpath, None)) |
1181 | 1179 |
elif self.path: |
1182 | 1180 |
raise CLIError( |
1183 | 1181 |
'Remote object /%s/%s is a directory' % ( |
1184 | 1182 |
self.container, local_path), |
1185 |
details=['Use %s to download directories' % '/'.join(
|
|
1186 |
self.arguments['recursive'].parsed_name)])
|
|
1183 |
details=['Use %s to download directories' % ( |
|
1184 |
self.arguments['recursive'].lvalue)])
|
|
1187 | 1185 |
else: |
1188 |
parsed_name = '/'.join(self.arguments['recursive'].parsed_name)
|
|
1186 |
parsed_name = self.arguments['recursive'].lvalue
|
|
1189 | 1187 |
raise CLIError( |
1190 | 1188 |
'Cannot download container %s' % self.container, |
1191 | 1189 |
details=[ |
... | ... | |
1197 | 1195 |
if path.exists(local_path) and not self['resume']: |
1198 | 1196 |
raise CLIError( |
1199 | 1197 |
'Cannot overwrite local file %s' % (lpath), |
1200 |
details=['To overwrite/resume, use %s' % '/'.join(
|
|
1201 |
self.arguments['resume'].parsed_name)])
|
|
1198 |
details=['To overwrite/resume, use %s' % ( |
|
1199 |
self.arguments['resume'].lvalue)])
|
|
1202 | 1200 |
ret.append((rpath, local_path, self['resume'])) |
1203 | 1201 |
for r, l, resume in ret: |
1204 | 1202 |
if r: |
... | ... | |
1528 | 1526 |
delimiter, msg = '/', 'Empty and d%s' % msg[1:] |
1529 | 1527 |
elif num_of_contents: |
1530 | 1528 |
raise CLIError('Container %s is not empty' % container, details=[ |
1531 |
'Use %s to delete non-empty containers' % '/'.join(
|
|
1532 |
self.arguments['recursive'].parsed_name)])
|
|
1529 |
'Use %s to delete non-empty containers' % ( |
|
1530 |
self.arguments['recursive'].lvalue)])
|
|
1533 | 1531 |
if self['yes'] or self.ask_user(msg): |
1534 | 1532 |
if num_of_contents: |
1535 | 1533 |
self.client.del_container(delimiter=delimiter) |
... | ... | |
1658 | 1656 |
else: |
1659 | 1657 |
raise CLISyntaxError( |
1660 | 1658 |
'No valid users specified, use %s or %s' % ( |
1661 |
'/'.join(self.arguments['user_uuid'].parsed_name),
|
|
1662 |
'/'.join(self.arguments['username'].parsed_name)),
|
|
1659 |
self.arguments['user_uuid'].lvalue,
|
|
1660 |
self.arguments['username'].lvalue),
|
|
1663 | 1661 |
details=[ |
1664 | 1662 |
'Check if a username or uuid is valid with', |
1665 | 1663 |
' user uuid2username', 'OR', ' user username2uuid']) |
Also available in: Unified diff