Skip to content

Commit

Permalink
Merge pull request iterative#854 from efiop/master
Browse files Browse the repository at this point in the history
link: properly iterate cache types
  • Loading branch information
efiop authored Jul 3, 2018
2 parents b952e59 + 425e44b commit 65b5dcb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions dvc/remote/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ def link(self, cache, path):
if not os.path.exists(dname):
os.makedirs(dname)

i = 0
N = len(self.cache_types)
while i < N:
i = len(self.cache_types)
while i > 0:
try:
self.CACHE_TYPE_MAP[self.cache_types[i]](cache, path)
self.CACHE_TYPE_MAP[self.cache_types[0]](cache, path)
return
except Exception as exc:
msg = 'Cache type \'{}\' is not supported'.format(self.cache_types[i])
msg = 'Cache type \'{}\' is not supported'.format(self.cache_types[0])
Logger.debug(msg)
del self.cache_types[i]
i += 1
del self.cache_types[0]
i -= 1

raise DvcException('No possible cache types left to try out.')

Expand Down

0 comments on commit 65b5dcb

Please sign in to comment.