1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

only access match if we actually match fact

fixes #18601
This commit is contained in:
Brian Coca 2016-11-23 19:00:48 -05:00
parent 778c983ef9
commit fbe5878919

View file

@ -1599,8 +1599,10 @@ class SunOSHardware(Hardware):
rc returns 1
"""
if out:
system_conf = out.split('\n')[0]
self.facts['product_name'] = re.search(r'(\w+\sEnterprise\s\w+)',system_conf).group(1)
system_conf = out.split('\n')[0]
found = re.search(r'(\w+\sEnterprise\s\w+)',system_conf)
if found:
self.facts['product_name'] = found.group(1)
class OpenBSDHardware(Hardware):
"""