Skip to content

Commit

Permalink
Add error handling for case where user does not have git installed (#…
Browse files Browse the repository at this point in the history
…3179) (#3198)

(cherry picked from commit 5ecba6b)
  • Loading branch information
SchrodingersGat committed Jun 15, 2022
1 parent 9bdbb01 commit f9c28ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions InvenTree/plugin/helpers.py
Expand Up @@ -114,6 +114,9 @@ def get_git_log(path):
output = output.split('\n')
except subprocess.CalledProcessError: # pragma: no cover
pass
except FileNotFoundError: # pragma: no cover
# Most likely the system does not have 'git' installed
pass

if not output:
output = 7 * [''] # pragma: no cover
Expand All @@ -129,6 +132,9 @@ def check_git_version():
output = str(subprocess.check_output(['git', '--version'], cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')
except subprocess.CalledProcessError: # pragma: no cover
return False
except FileNotFoundError: # pragma: no cover
# Most likely the system does not have 'git' installed
return False

# process version string
try:
Expand Down
3 changes: 3 additions & 0 deletions InvenTree/plugin/registry.py
Expand Up @@ -231,6 +231,9 @@ def install_plugin_file(self):
except subprocess.CalledProcessError as error: # pragma: no cover
logger.error(f'Ran into error while trying to install plugins!\n{str(error)}')
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}')

Expand Down

0 comments on commit f9c28ee

Please sign in to comment.