mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
d2c4f57f16
commit
9edeb19354
2 changed files with 21 additions and 2 deletions
3
changelogs/fragments/solaris_system_vendor.yaml
Normal file
3
changelogs/fragments/solaris_system_vendor.yaml
Normal file
|
@ -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…
Reference in a new issue