Revision 2d158d8b
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
1020 | 1020 |
'do not show progress bar', |
1021 | 1021 |
('-N', '--no-progress-bar'), |
1022 | 1022 |
default=False), |
1023 |
overwrite=FlagArgument('Force (over)write', ('-f', '--force')) |
|
1023 |
overwrite=FlagArgument('Force (over)write', ('-f', '--force')), |
|
1024 |
recursive=FlagArgument( |
|
1025 |
'Recursively upload directory *contents* + subdirectories', |
|
1026 |
('-R', '--recursive')) |
|
1024 | 1027 |
) |
1025 | 1028 |
|
1026 | 1029 |
def _check_container_limit(self, path): |
... | ... | |
1048 | 1051 |
def _path_pairs(self, local_path, remote_path): |
1049 | 1052 |
"""Get pairs of local and remote paths""" |
1050 | 1053 |
lpath = path.abspath(local_path) |
1051 |
self._check_container_limit(lpath) |
|
1052 | 1054 |
short_path = lpath.split(path.sep)[-1] |
1053 | 1055 |
rpath = remote_path or short_path |
1054 | 1056 |
if path.isdir(lpath): |
1057 |
if not self['recursive']: |
|
1058 |
raiseCLIError('%s is a directory' % lpath, details=[ |
|
1059 |
'Use -R to upload directory contents']) |
|
1055 | 1060 |
robj = self.client.container_get(path=rpath) |
1056 | 1061 |
if robj.json and not self['overwrite']: |
1057 | 1062 |
raiseCLIError( |
... | ... | |
1071 | 1076 |
except ClientError as ce: |
1072 | 1077 |
if ce.status != 404: |
1073 | 1078 |
raise |
1079 |
self._check_container_limit(lpath) |
|
1074 | 1080 |
prev = '' |
1075 | 1081 |
for top, subdirs, files in walk(lpath): |
1076 | 1082 |
if top != prev: |
... | ... | |
1103 | 1109 |
except ClientError as ce: |
1104 | 1110 |
if ce.status != 404: |
1105 | 1111 |
raise |
1112 |
self._check_container_limit(lpath) |
|
1106 | 1113 |
yield open(lpath, 'rb'), rpath |
1107 | 1114 |
|
1108 | 1115 |
@errors.generic.all |
Also available in: Unified diff