Merge pull request #34322 from Ch3LL/add_grains_majorrelease_test

add osmajorrelease grain for raspbian
This commit is contained in:
Mike Place 2016-06-28 12:08:39 -07:00 committed by GitHub
commit 75aad073a9
2 changed files with 12 additions and 1 deletions

View File

@ -1489,6 +1489,8 @@ def os_data():
os=grains['osfullname'],
ver=grains['osrelease'].partition('.')[0])
elif grains.get('osfullname') == 'Ubuntu':
grains['osmajorrelease'] = grains['osrelease'].split('.', 1)[0]
grains['osfinger'] = '{os}-{ver}'.format(
os=grains['osfullname'],
ver=grains['osrelease'])
@ -1498,7 +1500,7 @@ def os_data():
grains['osfinger'] = '{os}-{ver}'.format(
os=grains['osfullname'],
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['osfinger'] = '{os}-{ver}'.format(

View File

@ -106,6 +106,15 @@ class TestModulesGrains(integration.ModuleCase):
['level1:level2']),
'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):
'''