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

Use kstat for Solaris CPU info

This commit is contained in:
Chris Gardner 2013-05-28 22:36:09 +01:00 committed by Chris Gardner
parent dbfad567bc
commit 66c10410ec

View file

@ -655,13 +655,20 @@ class SunOSHardware(Hardware):
return self.facts
def get_cpu_facts(self):
rc, out, err = module.run_command("/usr/sbin/psrinfo -v")
rc, out, err = module.run_command("/usr/sbin/kstat cpu_info")
self.facts['processor'] = []
for line in out.split('\n'):
if 'processor operates' in line:
if len(line) < 1:
continue
data = line.split(None, 1)
key = data[0].strip()
# key "brand" works on Solaris 10
if key == 'brand':
if 'processor' not in self.facts:
self.facts['processor'] = []
self.facts['processor'].append(line.strip())
self.facts['processor'].append(data[1].strip())
# Counting cores on Solaris can be complicated. Leave as-is for now.
# https://blogs.oracle.com/mandalika/entry/solaris_show_me_the_cpu
self.facts['processor_cores'] = 'NA'
self.facts['processor_count'] = len(self.facts['processor'])