Merge "Unified exception in repo create"

This commit is contained in:
Jenkins 2016-01-21 13:00:46 +00:00 committed by Gerrit Code Review
commit 176d1ba8d4

View File

@ -153,12 +153,20 @@ class Repository(object):
os.mkdir(self.fpath)
except OSError as e:
if e.errno == errno.EEXIST:
raise RepositoryExists("Repository %s exists" % self.name)
raise RepositoryExists("Repository %s "
"already exists" % self.name)
else:
raise
self._add_contents(source)
else:
os.symlink(source, self.fpath)
try:
os.symlink(source, self.fpath)
except OSError as e:
if e.errno == errno.EEXIST:
raise RepositoryExists("Repository %s "
"already exists" % self.name)
else:
raise
def update(self, source, overwrite=False):
self._add_contents(source, overwrite)