mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
Add error handling for case where user does not have git installed (#3179)
This commit is contained in:
parent
090f4f4387
commit
5ecba6b13c
@ -111,6 +111,9 @@ def get_git_log(path):
|
|||||||
output = output.split('\n')
|
output = output.split('\n')
|
||||||
except subprocess.CalledProcessError: # pragma: no cover
|
except subprocess.CalledProcessError: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
except FileNotFoundError: # pragma: no cover
|
||||||
|
# Most likely the system does not have 'git' installed
|
||||||
|
pass
|
||||||
|
|
||||||
if not output:
|
if not output:
|
||||||
output = 7 * [''] # pragma: no cover
|
output = 7 * [''] # pragma: no cover
|
||||||
@ -125,6 +128,9 @@ def check_git_version():
|
|||||||
output = str(subprocess.check_output(['git', '--version'], cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')
|
output = str(subprocess.check_output(['git', '--version'], cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')
|
||||||
except subprocess.CalledProcessError: # pragma: no cover
|
except subprocess.CalledProcessError: # pragma: no cover
|
||||||
return False
|
return False
|
||||||
|
except FileNotFoundError: # pragma: no cover
|
||||||
|
# Most likely the system does not have 'git' installed
|
||||||
|
return False
|
||||||
|
|
||||||
# process version string
|
# process version string
|
||||||
try:
|
try:
|
||||||
|
@ -227,6 +227,9 @@ class PluginsRegistry:
|
|||||||
except subprocess.CalledProcessError as error: # pragma: no cover
|
except subprocess.CalledProcessError as error: # pragma: no cover
|
||||||
logger.error(f'Ran into error while trying to install plugins!\n{str(error)}')
|
logger.error(f'Ran into error while trying to install plugins!\n{str(error)}')
|
||||||
return False
|
return False
|
||||||
|
except FileNotFoundError: # pragma: no cover
|
||||||
|
# System most likely does not have 'git' installed
|
||||||
|
return False
|
||||||
|
|
||||||
logger.info(f'plugin requirements were run\n{output}')
|
logger.info(f'plugin requirements were run\n{output}')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user