diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index c1285027be9..63a7d4d0a66 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -2507,18 +2507,21 @@ class SunOSVirtual(Virtual): # DOMAINROLE|impl=LDoms|control=false|io=false|service=false|root=false # The output may also be not formated and the returncode is set to 0 regardless of the error condition: # virtinfo can only be run from the global zone - for line in out.split('\n'): - fields = line.split('|') - if( fields[0] == 'DOMAINROLE' and fields[1] == 'impl=LDoms' ): - self.facts['virtualization_type'] = 'ldom' - self.facts['virtualization_role'] = 'guest' - hostfeatures = [] - for field in fields[2:]: - arg = field.split('=') - if( arg[1] == 'true' ): - hostfeatures.append(arg[0]) - if( len(hostfeatures) > 0 ): - self.facts['virtualization_role'] = 'host (' + ','.join(hostfeatures) + ')' + try: + for line in out.split('\n'): + fields = line.split('|') + if( fields[0] == 'DOMAINROLE' and fields[1] == 'impl=LDoms' ): + self.facts['virtualization_type'] = 'ldom' + self.facts['virtualization_role'] = 'guest' + hostfeatures = [] + for field in fields[2:]: + arg = field.split('=') + if( arg[1] == 'true' ): + hostfeatures.append(arg[0]) + if( len(hostfeatures) > 0 ): + self.facts['virtualization_role'] = 'host (' + ','.join(hostfeatures) + ')' + except ValueError, e: + pass def get_file_content(path, default=None, strip=True): data = default