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:
parent
dbfad567bc
commit
66c10410ec
1 changed files with 10 additions and 3 deletions
|
@ -655,13 +655,20 @@ class SunOSHardware(Hardware):
|
||||||
return self.facts
|
return self.facts
|
||||||
|
|
||||||
def get_cpu_facts(self):
|
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'] = []
|
self.facts['processor'] = []
|
||||||
for line in out.split('\n'):
|
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:
|
if 'processor' not in self.facts:
|
||||||
self.facts['processor'] = []
|
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_cores'] = 'NA'
|
||||||
self.facts['processor_count'] = len(self.facts['processor'])
|
self.facts['processor_count'] = len(self.facts['processor'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue