mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Fix spurious error in master log
When only GitPython is installed, and no gitfs_provider is set, an error about pygit2 not being available is logged. This should not happen, as gitfs should just select the first available out of pygit2, gitpython, and dulwich. This fixes #17945 by suppressing the error.
This commit is contained in:
parent
d2c543cca9
commit
e7a3142f1a
@ -137,16 +137,21 @@ def _verify_gitpython(quiet=False):
|
|||||||
'''
|
'''
|
||||||
Check if GitPython is available and at a compatible version (>= 0.3.0)
|
Check if GitPython is available and at a compatible version (>= 0.3.0)
|
||||||
'''
|
'''
|
||||||
|
def _recommend():
|
||||||
|
if HAS_PYGIT2:
|
||||||
|
log.error(_RECOMMEND_PYGIT2)
|
||||||
|
if HAS_DULWICH:
|
||||||
|
log.error(_RECOMMEND_DULWICH)
|
||||||
|
|
||||||
if not HAS_GITPYTHON:
|
if not HAS_GITPYTHON:
|
||||||
|
if not quiet:
|
||||||
log.error(
|
log.error(
|
||||||
'Git fileserver backend is enabled in master config file, but '
|
'Git fileserver backend is enabled in master config file, but '
|
||||||
'could not be loaded, is GitPython installed?'
|
'could not be loaded, is GitPython installed?'
|
||||||
)
|
)
|
||||||
if HAS_PYGIT2 and not quiet:
|
_recommend()
|
||||||
log.error(_RECOMMEND_PYGIT2)
|
|
||||||
if HAS_DULWICH and not quiet:
|
|
||||||
log.error(_RECOMMEND_DULWICH)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
gitver = distutils.version.LooseVersion(git.__version__)
|
gitver = distutils.version.LooseVersion(git.__version__)
|
||||||
minver_str = '0.3.0'
|
minver_str = '0.3.0'
|
||||||
minver = distutils.version.LooseVersion(minver_str)
|
minver = distutils.version.LooseVersion(minver_str)
|
||||||
@ -162,15 +167,15 @@ def _verify_gitpython(quiet=False):
|
|||||||
'The git command line utility is required by the Git fileserver '
|
'The git command line utility is required by the Git fileserver '
|
||||||
'backend when using the \'gitpython\' provider.'
|
'backend when using the \'gitpython\' provider.'
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
if HAS_PYGIT2 and not quiet:
|
|
||||||
errors.append(_RECOMMEND_PYGIT2)
|
|
||||||
if HAS_DULWICH and not quiet:
|
|
||||||
errors.append(_RECOMMEND_DULWICH)
|
|
||||||
for error in errors:
|
for error in errors:
|
||||||
log.error(error)
|
log.error(error)
|
||||||
|
if not quiet:
|
||||||
|
_recommend()
|
||||||
return False
|
return False
|
||||||
log.info('gitpython gitfs_provider enabled')
|
|
||||||
|
log.debug('gitpython gitfs_provider enabled')
|
||||||
__opts__['verified_gitfs_provider'] = 'gitpython'
|
__opts__['verified_gitfs_provider'] = 'gitpython'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -180,15 +185,19 @@ def _verify_pygit2(quiet=False):
|
|||||||
Check if pygit2/libgit2 are available and at a compatible version. Pygit2
|
Check if pygit2/libgit2 are available and at a compatible version. Pygit2
|
||||||
must be at least 0.20.3 and libgit2 must be at least 0.20.0.
|
must be at least 0.20.3 and libgit2 must be at least 0.20.0.
|
||||||
'''
|
'''
|
||||||
|
def _recommend():
|
||||||
|
if HAS_GITPYTHON:
|
||||||
|
log.error(_RECOMMEND_GITPYTHON)
|
||||||
|
if HAS_DULWICH:
|
||||||
|
log.error(_RECOMMEND_DULWICH)
|
||||||
|
|
||||||
if not HAS_PYGIT2:
|
if not HAS_PYGIT2:
|
||||||
|
if not quiet:
|
||||||
log.error(
|
log.error(
|
||||||
'Git fileserver backend is enabled in master config file, but '
|
'Git fileserver backend is enabled in master config file, but '
|
||||||
'could not be loaded, are pygit2 and libgit2 installed?'
|
'could not be loaded, are pygit2 and libgit2 installed?'
|
||||||
)
|
)
|
||||||
if HAS_GITPYTHON and not quiet:
|
_recommend()
|
||||||
log.error(_RECOMMEND_GITPYTHON)
|
|
||||||
if HAS_DULWICH and not quiet:
|
|
||||||
log.error(_RECOMMEND_DULWICH)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
pygit2ver = distutils.version.LooseVersion(pygit2.__version__)
|
pygit2ver = distutils.version.LooseVersion(pygit2.__version__)
|
||||||
@ -217,15 +226,15 @@ def _verify_pygit2(quiet=False):
|
|||||||
'The git command line utility is required by the Git fileserver '
|
'The git command line utility is required by the Git fileserver '
|
||||||
'backend when using the \'pygit2\' provider.'
|
'backend when using the \'pygit2\' provider.'
|
||||||
)
|
)
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
if HAS_GITPYTHON and not quiet:
|
|
||||||
errors.append(_RECOMMEND_GITPYTHON)
|
|
||||||
if HAS_DULWICH and not quiet:
|
|
||||||
errors.append(_RECOMMEND_DULWICH)
|
|
||||||
for error in errors:
|
for error in errors:
|
||||||
log.error(error)
|
log.error(error)
|
||||||
|
if not quiet:
|
||||||
|
_recommend()
|
||||||
return False
|
return False
|
||||||
log.info('pygit2 gitfs_provider enabled')
|
|
||||||
|
log.debug('pygit2 gitfs_provider enabled')
|
||||||
__opts__['verified_gitfs_provider'] = 'pygit2'
|
__opts__['verified_gitfs_provider'] = 'pygit2'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -234,15 +243,19 @@ def _verify_dulwich(quiet=False):
|
|||||||
'''
|
'''
|
||||||
Check if dulwich is available.
|
Check if dulwich is available.
|
||||||
'''
|
'''
|
||||||
|
def _recommend():
|
||||||
|
if HAS_GITPYTHON:
|
||||||
|
log.error(_RECOMMEND_GITPYTHON)
|
||||||
|
if HAS_PYGIT2:
|
||||||
|
log.error(_RECOMMEND_PYGIT2)
|
||||||
|
|
||||||
if not HAS_DULWICH:
|
if not HAS_DULWICH:
|
||||||
|
if not quiet:
|
||||||
log.error(
|
log.error(
|
||||||
'Git fileserver backend is enabled in the master config file, but '
|
'Git fileserver backend is enabled in the master config file, but '
|
||||||
'could not be loaded. Is Dulwich installed?'
|
'could not be loaded. Is Dulwich installed?'
|
||||||
)
|
)
|
||||||
if HAS_GITPYTHON and not quiet:
|
_recommend()
|
||||||
log.error(_RECOMMEND_GITPYTHON)
|
|
||||||
if HAS_PYGIT2 and not quiet:
|
|
||||||
log.error(_RECOMMEND_PYGIT2)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
dulwich_version = dulwich.__version__
|
dulwich_version = dulwich.__version__
|
||||||
@ -257,16 +270,14 @@ def _verify_dulwich(quiet=False):
|
|||||||
'detected.'.format(dulwich_min_version, dulwich_version)
|
'detected.'.format(dulwich_min_version, dulwich_version)
|
||||||
)
|
)
|
||||||
|
|
||||||
if HAS_PYGIT2 and not quiet:
|
if errors:
|
||||||
errors.append(_RECOMMEND_PYGIT2)
|
|
||||||
if HAS_GITPYTHON and not quiet:
|
|
||||||
errors.append(_RECOMMEND_GITPYTHON)
|
|
||||||
|
|
||||||
for error in errors:
|
for error in errors:
|
||||||
log.error(error)
|
log.error(error)
|
||||||
|
if not quiet:
|
||||||
|
_recommend()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
log.info('dulwich gitfs_provider enabled')
|
log.debug('dulwich gitfs_provider enabled')
|
||||||
__opts__['verified_gitfs_provider'] = 'dulwich'
|
__opts__['verified_gitfs_provider'] = 'dulwich'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user