mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Only use pygit2.errors if it exists (2015.5 branch)
pygit2 0.20.3 is the only supported pygit2 for gitfs which doesn't have this errors submodule. We need to account for it not being there. Fixes #26245 for the 2015.5 branch
This commit is contained in:
parent
c5eb6bbd3e
commit
19a1149067
1 changed files with 5 additions and 1 deletions
|
@ -115,6 +115,10 @@ except ImportError:
|
|||
try:
|
||||
import pygit2
|
||||
HAS_PYGIT2 = True
|
||||
try:
|
||||
GitError = pygit2.errors.GitError
|
||||
except AttributeError:
|
||||
GitError = Exception
|
||||
except ImportError:
|
||||
HAS_PYGIT2 = False
|
||||
|
||||
|
@ -1159,7 +1163,7 @@ def update():
|
|||
pass
|
||||
try:
|
||||
fetch = origin.fetch()
|
||||
except pygit2.errors.GitError as exc:
|
||||
except GitError as exc:
|
||||
# Using exc.__str__() here to avoid deprecation warning
|
||||
# when referencing exc.message
|
||||
if 'unsupported url protocol' in exc.__str__().lower() \
|
||||
|
|
Loading…
Add table
Reference in a new issue