Populate product_name and system_vendor facts on Solaris (#44114)

* Populate product_name and system_vendor facts on Solaris

* Add QEMU as Solaris "hardware" vendor.

* Lint fix.
pull/51229/head
Peter Oliver 6 years ago committed by Dag Wieers
parent d2c4f57f16
commit 9edeb19354

@ -0,0 +1,3 @@
---
minor_changes:
- On Solaris, the `ansible_product_name` fact is populated for a wider range of older hardware models, and `ansible_system_vendor` fact is populated for certain known vendors.

@ -180,10 +180,26 @@ class SunOSHardware(Hardware):
"""
if out:
system_conf = out.split('\n')[0]
found = re.search(r'(\w+\sEnterprise\s\w+)', system_conf)
# If you know of any other manufacturers whose names appear in
# the first line of prtdiag's output, please add them here:
vendors = [
"Fujitsu",
"Oracle Corporation",
"QEMU",
"Sun Microsystems",
"VMware, Inc.",
]
vendor_regexp = "|".join(map(re.escape, vendors))
system_conf_regexp = (r'System Configuration:\s+'
+ r'(' + vendor_regexp + r')\s+'
+ r'(?:sun\w+\s+)?'
+ r'(.+)')
found = re.match(system_conf_regexp, system_conf)
if found:
dmi_facts['product_name'] = found.group(1)
dmi_facts['system_vendor'] = found.group(1)
dmi_facts['product_name'] = found.group(2)
return dmi_facts

Loading…
Cancel
Save