mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-04 17:01:09 +00:00
[Bugfix] 修复获取kvmcpu的bug
This commit is contained in:
@@ -36,9 +36,10 @@ def set_assets_hardware_info(result, **kwargs):
|
|||||||
result_raw = result[0]
|
result_raw = result[0]
|
||||||
assets_updated = []
|
assets_updated = []
|
||||||
for hostname, info in result_raw.get('ok', {}).items():
|
for hostname, info in result_raw.get('ok', {}).items():
|
||||||
if info:
|
if info and info.get('setup'):
|
||||||
info = info['setup']['ansible_facts']
|
info = info['setup']['ansible_facts']
|
||||||
else:
|
else:
|
||||||
|
logger.error("Get asset info failed: {}".format(hostname))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
asset = get_object_or_none(Asset, hostname=hostname)
|
asset = get_object_or_none(Asset, hostname=hostname)
|
||||||
@@ -50,7 +51,7 @@ def set_assets_hardware_info(result, **kwargs):
|
|||||||
___sn = info['ansible_product_serial']
|
___sn = info['ansible_product_serial']
|
||||||
|
|
||||||
for ___cpu_model in info['ansible_processor']:
|
for ___cpu_model in info['ansible_processor']:
|
||||||
if ___cpu_model.endswith('GHz'):
|
if ___cpu_model.endswith('GHz') or ___cpu_model.startswith("Intel"):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
___cpu_model = 'Unknown'
|
___cpu_model = 'Unknown'
|
||||||
|
Reference in New Issue
Block a user