diff --git a/salt/grains/core.py b/salt/grains/core.py index 2b769e3528..23ac339b66 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -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( diff --git a/tests/integration/modules/grains.py b/tests/integration/modules/grains.py index 5bd3173723..f1c6937a80 100644 --- a/tests/integration/modules/grains.py +++ b/tests/integration/modules/grains.py @@ -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): '''