Commit 41756b06 authored by ibuler's avatar ibuler

[Bugfix] 修复获取kvmcpu的bug

parent 9e36a2cb
......@@ -36,9 +36,10 @@ def set_assets_hardware_info(result, **kwargs):
result_raw = result[0]
assets_updated = []
for hostname, info in result_raw.get('ok', {}).items():
if info:
if info and info.get('setup'):
info = info['setup']['ansible_facts']
else:
logger.error("Get asset info failed: {}".format(hostname))
continue
asset = get_object_or_none(Asset, hostname=hostname)
......@@ -50,7 +51,7 @@ def set_assets_hardware_info(result, **kwargs):
___sn = info['ansible_product_serial']
for ___cpu_model in info['ansible_processor']:
if ___cpu_model.endswith('GHz'):
if ___cpu_model.endswith('GHz') or ___cpu_model.startswith("Intel"):
break
else:
___cpu_model = 'Unknown'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment