mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix swap translation on 4.x openbsd with 2.5.4 python
This commit is contained in:
parent
14cf3c4d2a
commit
379e1a49cb
1 changed files with 5 additions and 2 deletions
|
@ -31,6 +31,8 @@ import getpass
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import StringIO
|
import StringIO
|
||||||
|
|
||||||
|
from string import maketrans
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import selinux
|
import selinux
|
||||||
HAVE_SELINUX=True
|
HAVE_SELINUX=True
|
||||||
|
@ -910,9 +912,10 @@ class OpenBSDHardware(Hardware):
|
||||||
# total: 69268k bytes allocated = 0k used, 69268k available
|
# total: 69268k bytes allocated = 0k used, 69268k available
|
||||||
rc, out, err = module.run_command("/sbin/swapctl -sk")
|
rc, out, err = module.run_command("/sbin/swapctl -sk")
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
|
swaptrans = maketrans(' ', ' ')
|
||||||
data = out.split()
|
data = out.split()
|
||||||
self.facts['swapfree_mb'] = long(data[-2].translate(None, "kmg")) / 1024
|
self.facts['swapfree_mb'] = long(data[-2].translate(swaptrans, "kmg")) / 1024
|
||||||
self.facts['swaptotal_mb'] = long(data[1].translate(None, "kmg")) / 1024
|
self.facts['swaptotal_mb'] = long(data[1].translate(swaptrans, "kmg")) / 1024
|
||||||
|
|
||||||
def get_processor_facts(self):
|
def get_processor_facts(self):
|
||||||
processor = []
|
processor = []
|
||||||
|
|
Loading…
Reference in a new issue