Merge pull request #47865 from rallytime/bp-47600

Back-port #47600 to 2018.3
This commit is contained in:
Nicole Thomas 2018-05-29 15:54:43 -04:00 committed by GitHub
commit d9e7f2b5b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -451,7 +451,11 @@ def _bsd_memdata(osdata):
if osdata['kernel'] in ['OpenBSD', 'NetBSD']:
swapctl = salt.utils.path.which('swapctl')
swap_total = __salt__['cmd.run']('{0} -sk'.format(swapctl)).split(' ')[1]
swap_data = __salt__['cmd.run']('{0} -sk'.format(swapctl))
if swap_data == 'no swap devices configured':
swap_total = 0
else:
swap_total = swap_data.split(' ')[1]
else:
swap_total = __salt__['cmd.run']('{0} -n vm.swap_total'.format(sysctl))
grains['swap_total'] = int(swap_total) // 1024 // 1024