From 0771efa10a764b397d1303c41717095defbed711 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Tue, 9 Sep 2014 14:12:19 +0200 Subject: [PATCH] Add git support to get revision --- server_environment/system_info.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server_environment/system_info.py b/server_environment/system_info.py index e6d522d9f..bd0f5fea8 100644 --- a/server_environment/system_info.py +++ b/server_environment/system_info.py @@ -37,9 +37,12 @@ def _get_output(cmd): def get_server_environment(): # inspired by server/bin/service/web_services.py try: - rev_id = _get_output('bzr revision-info') - except Exception as e: - rev_id = 'Exception: %s' % (e,) + rev_id = 'git:%s' % _get_output('git rev-parse HEAD') + except Exception: + try: + rev_id = 'bzr: %s' % _get_output('bzr revision-info') + except Exception: + rev_id = 'Can not retrive revison from git or bzr' os_lang = '.'.join([x for x in locale.getdefaultlocale() if x]) if not os_lang: @@ -50,7 +53,7 @@ def get_server_environment(): lsbinfo = 'not lsb compliant' return ( ('platform', platform.platform()), - ('os.name', os.name), + ('os name', os.name), ('lsb_release', lsbinfo), ('release', platform.release()), ('version', platform.version()),