system-info: added UUID placeholder for generating platform unique identifiers.
This commit is contained in:
parent
83ff493336
commit
091c53d8e4
3 changed files with 23 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue