From 41756b06e19158c39eed5b2d53736da3e07ad4ee Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 26 Jan 2018 16:21:14 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?kvmcpu=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/assets/tasks.py b/apps/assets/tasks.py index 3900de769..dc4a3b2fa 100644 --- a/apps/assets/tasks.py +++ b/apps/assets/tasks.py @@ -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'