diff --git a/iop4api/views/index.py b/iop4api/views/index.py index 60d050ad..5ceb139a 100644 --- a/iop4api/views/index.py +++ b/iop4api/views/index.py @@ -21,9 +21,15 @@ import logging logger = logging.getLogger(__name__) -GIT_COMMIT_HASH = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=os.path.dirname(os.path.realpath(__file__))).decode('ascii').strip() -GIT_BRANCH = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], cwd=os.path.dirname(os.path.realpath(__file__))).decode('ascii').strip() -GIT_DESCRIBE = subprocess.check_output(['git', 'describe', '--always'], cwd=os.path.dirname(os.path.realpath(__file__))).decode('ascii').strip() +try: + GIT_COMMIT_HASH = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=os.path.dirname(os.path.realpath(__file__))).decode('ascii').strip() + GIT_BRANCH = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], cwd=os.path.dirname(os.path.realpath(__file__))).decode('ascii').strip() + GIT_DESCRIBE = subprocess.check_output(['git', 'describe', '--always'], cwd=os.path.dirname(os.path.realpath(__file__))).decode('ascii').strip() +except Exception as e: + logger.error(f"Error getting git info: {e}") + GIT_COMMIT_HASH = "Unknown" + GIT_BRANCH = "Unknown" + GIT_DESCRIBE = "Unknown" def index(request, tabs=None):