mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Fix swap_total for macosx grain detection
This commit is contained in:
parent
76a4d70449
commit
4d6abeff66
@ -425,14 +425,14 @@ def _osx_memdata():
|
||||
sysctl = salt.utils.path.which('sysctl')
|
||||
if sysctl:
|
||||
mem = __salt__['cmd.run']('{0} -n hw.memsize'.format(sysctl))
|
||||
swap_total = __salt__['cmd.run']('{0} -n vm.swapusage').split()[2]
|
||||
swap_total = __salt__['cmd.run']('{0} -n vm.swapusage'.format(sysctl)).split()[2]
|
||||
if swap_total.endswith('K'):
|
||||
_power = 2**10
|
||||
elif swap_total.endswith('M'):
|
||||
_power = 2**20
|
||||
elif swap_total.endswith('G'):
|
||||
_power = 2**30
|
||||
swap_total = swap_total[:-1] * _power
|
||||
swap_total = float(swap_total[:-1]) * _power
|
||||
|
||||
grains['mem_total'] = int(mem) // 1024 // 1024
|
||||
grains['swap_total'] = int(swap_total) // 1024 // 1024
|
||||
|
Loading…
Reference in New Issue
Block a user