mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Added exception handler for git repo init
This commit is contained in:
parent
00faa5f002
commit
ff1d58f342
@ -127,7 +127,14 @@ def init():
|
||||
rp_ = os.path.join(bp_, repo_hash)
|
||||
if not os.path.isdir(rp_):
|
||||
os.makedirs(rp_)
|
||||
repo = git.Repo.init(rp_)
|
||||
|
||||
try:
|
||||
repo = git.Repo.init(rp_)
|
||||
except Exception as e:
|
||||
log.error('GitPython exception caught while initializing the repo '
|
||||
'for gitfs: {0}. Maybe git is not available.'.format(e))
|
||||
return repos
|
||||
|
||||
if not repo.remotes:
|
||||
try:
|
||||
repo.create_remote('origin', opt)
|
||||
|
@ -111,7 +111,14 @@ def init(branch, repo_location):
|
||||
|
||||
if not os.path.isdir(rp_):
|
||||
os.makedirs(rp_)
|
||||
repo = git.Repo.init(rp_)
|
||||
|
||||
try:
|
||||
repo = git.Repo.init(rp_)
|
||||
except Exception as e:
|
||||
log.error('GitPython exception caught while initializing the repo for '
|
||||
'git_pillar: {0}. Maybe git is not available.'.format(e))
|
||||
return None
|
||||
|
||||
if not repo.remotes:
|
||||
try:
|
||||
repo.create_remote('origin', repo_location)
|
||||
|
Loading…
Reference in New Issue
Block a user