mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-07 00:39:09 -07:00
Use try block for field splitting
This commit is contained in:
parent
90e760ba84
commit
c1dba60961
1 changed files with 15 additions and 12 deletions
|
@ -2507,6 +2507,7 @@ class SunOSVirtual(Virtual):
|
||||||
# DOMAINROLE|impl=LDoms|control=false|io=false|service=false|root=false
|
# 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:
|
# 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
|
# virtinfo can only be run from the global zone
|
||||||
|
try:
|
||||||
for line in out.split('\n'):
|
for line in out.split('\n'):
|
||||||
fields = line.split('|')
|
fields = line.split('|')
|
||||||
if( fields[0] == 'DOMAINROLE' and fields[1] == 'impl=LDoms' ):
|
if( fields[0] == 'DOMAINROLE' and fields[1] == 'impl=LDoms' ):
|
||||||
|
@ -2519,6 +2520,8 @@ class SunOSVirtual(Virtual):
|
||||||
hostfeatures.append(arg[0])
|
hostfeatures.append(arg[0])
|
||||||
if( len(hostfeatures) > 0 ):
|
if( len(hostfeatures) > 0 ):
|
||||||
self.facts['virtualization_role'] = 'host (' + ','.join(hostfeatures) + ')'
|
self.facts['virtualization_role'] = 'host (' + ','.join(hostfeatures) + ')'
|
||||||
|
except ValueError, e:
|
||||||
|
pass
|
||||||
|
|
||||||
def get_file_content(path, default=None, strip=True):
|
def get_file_content(path, default=None, strip=True):
|
||||||
data = default
|
data = default
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue