Skip to content

Commit

Permalink
add num_cpus grain to freebsd (#34565)
Browse files Browse the repository at this point in the history
* add num_cpus grain to freebsd

* fix pylint
  • Loading branch information
Ch3LL authored and Nicole Thomas committed Jul 13, 2016
1 parent 445f8af commit f6dfbac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions salt/grains/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@ def os_data():
# freebsd-version was introduced in 10.0.
# derive osrelease from kernelversion prior to that
grains['osrelease'] = grains['kernelrelease'].split('-')[0]
grains.update(_bsd_cpudata(grains))
if grains['kernel'] in ('OpenBSD', 'NetBSD'):
grains.update(_bsd_cpudata(grains))
grains['osrelease'] = grains['kernelrelease'].split('-')[0]
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/modules/grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ def test_get_core_grains(self):
continue
self.assertTrue(get_grain)

def test_get_grains_int(self):
'''
test to ensure int grains
are returned as integers
'''
grains = ['num_cpus', 'mem_total', 'num_gpus', 'uid']
for grain in grains:
get_grain = self.run_function('grains.get', [grain])

self.assertIsInstance(get_grain, int,
msg='grain: {0} is not an int or empty'.format(grain))


class GrainsAppendTestCase(integration.ModuleCase):
'''
Expand Down

0 comments on commit f6dfbac

Please sign in to comment.