add osmajorrelease grain for raspbian

This commit is contained in:
Ch3LL 2016-06-27 14:45:09 -06:00
parent 1398b1c51e
commit 2fc3e8a54b
2 changed files with 9 additions and 1 deletions

View File

@ -1498,7 +1498,7 @@ def os_data():
grains['osfinger'] = '{os}-{ver}'.format( grains['osfinger'] = '{os}-{ver}'.format(
os=grains['osfullname'], os=grains['osfullname'],
ver=grains['osrelease'].partition('.')[0]) ver=grains['osrelease'].partition('.')[0])
elif grains.get('os') in ('FreeBSD', 'OpenBSD', 'NetBSD', 'Mac'): elif grains.get('os') in ('FreeBSD', 'OpenBSD', 'NetBSD', 'Mac', 'Raspbian'):
grains['osmajorrelease'] = grains['osrelease'].split('.', 1)[0] grains['osmajorrelease'] = grains['osrelease'].split('.', 1)[0]
grains['osfinger'] = '{os}-{ver}'.format( grains['osfinger'] = '{os}-{ver}'.format(

View File

@ -105,6 +105,14 @@ class TestModulesGrains(integration.ModuleCase):
'grains.get', 'grains.get',
['level1:level2']), ['level1:level2']),
'foo') 'foo')
def test_get_core_grains(self):
'''
test to ensure some core grains are returned
'''
grains = ['os', 'os_family', 'osmajorrelease', 'osrelease', 'osfullname', 'id']
for grain in grains:
get_grain = self.run_function('grains.get', [grain])
self.assertTrue(get_grain, grain + "is not available")
class GrainsAppendTestCase(integration.ModuleCase): class GrainsAppendTestCase(integration.ModuleCase):