diff --git a/rhodecode/controllers/admin/settings.py b/rhodecode/controllers/admin/settings.py --- a/rhodecode/controllers/admin/settings.py +++ b/rhodecode/controllers/admin/settings.py @@ -589,7 +589,8 @@ class SettingsController(BaseController) ('', '', ''), # spacer # Platform/Python - (_('Platform'), val('platform'), state('platform')), + (_('Platform'), val('platform')['name'], state('platform')), + (_('Platform UUID'), val('platform')['uuid'], state('platform')), (_('Python version'), val('python')['version'], state('python')), (_('Python path'), val('python')['executable'], state('python')), ('', '', ''), # spacer diff --git a/rhodecode/lib/system_info.py b/rhodecode/lib/system_info.py --- a/rhodecode/lib/system_info.py +++ b/rhodecode/lib/system_info.py @@ -107,8 +107,12 @@ def py_modules(): def platform_type(): - from rhodecode.lib.utils import safe_unicode - value = safe_unicode(platform.platform()) + from rhodecode.lib.utils import safe_unicode, generate_platform_uuid + + value = dict( + name=safe_unicode(platform.platform()), + uuid=generate_platform_uuid() + ) return SysInfoRes(value=value) diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -33,6 +33,7 @@ import tempfile import traceback import tarfile import warnings +import hashlib from os.path import join as jn import paste @@ -1001,3 +1002,17 @@ def get_registry(request): return request.registry except AttributeError: return get_current_registry() + + +def generate_platform_uuid(): + """ + Generates platform UUID based on it's name + """ + import platform + + try: + uuid_list = [platform.platform()] + return hashlib.sha256(':'.join(uuid_list)).hexdigest() + except Exception as e: + log.error('Failed to generate host uuid: %s' % e) + return 'UNDEFINED'