Unified exception in repo create
Change-Id: I75b7f24d6fe2d60039488c3d672b2e5bcd3111de
This commit is contained in:
parent
8225dfbd75
commit
627abd4125
@ -153,12 +153,20 @@ class Repository(object):
|
|||||||
os.mkdir(self.fpath)
|
os.mkdir(self.fpath)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.EEXIST:
|
if e.errno == errno.EEXIST:
|
||||||
raise RepositoryExists("Repository %s exists" % self.name)
|
raise RepositoryExists("Repository %s "
|
||||||
|
"already exists" % self.name)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
self._add_contents(source)
|
self._add_contents(source)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
os.symlink(source, self.fpath)
|
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):
|
def update(self, source, overwrite=False):
|
||||||
self._add_contents(source, overwrite)
|
self._add_contents(source, overwrite)
|
||||||
|
Loading…
Reference in New Issue
Block a user