diff --git a/napalm_proxmox/driver.py b/napalm_proxmox/driver.py index 6db3640..d45ebd4 100644 --- a/napalm_proxmox/driver.py +++ b/napalm_proxmox/driver.py @@ -384,19 +384,16 @@ class ProxmoxDriver( serial = lines[3].strip() _bad = {"none", "n/a", "not specified", "to be filled by o.e.m."} - pv_ok = ( + pv_usable = ( product_version and product_version.lower() not in _bad and product_version != product_name + # Only prefer product_version when it contains a space — + # that indicates a human-readable marketing name like + # "ThinkCentre M910x" rather than a part code like "J26843-409". + and " " in product_version ) - # Use product_version as model when product_name looks like a - # raw type code (Lenovo style: all uppercase letters and digits) - import re as _re - pn_is_code = bool(_re.fullmatch(r"[A-Z0-9]+", product_name)) - if pn_is_code and pv_ok: - model = product_version - else: - model = product_name + model = product_version if pv_usable else product_name except Exception as exc: logger.debug("Failed to read DMI info via SSH: %s", exc)