Merge pull request #52250 from twangboy/fix_grains

Fix the domain grain on Windows
This commit is contained in:
Daniel Wozniak 2019-04-03 09:28:54 -07:00 committed by GitHub
commit e5a755d45d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View file

@ -2066,6 +2066,12 @@ def locale_info():
def hostname():
'''
Return fqdn, hostname, domainname
.. note::
On Windows the ``domain`` grain may refer to the dns entry for the host
instead of the Windows domain to which the host is joined. It may also
be empty if not a part of any domain. Refer to the ``windowsdomain``
grain instead
'''
# This is going to need some work
# Provides:

View file

@ -133,6 +133,28 @@ class CoreGrainsTestCase(TestCase, LoaderModuleMockMixin):
os_release = core._parse_os_release('/etc/os-release', '/usr/lib/os-release')
self.assertEqual(os_release, {})
@skipIf(not salt.utils.platform.is_windows(), 'System is not Windows')
def test__windows_platform_data(self):
grains = core._windows_platform_data()
keys = ['biosversion',
'osrelease',
'domain',
'kernelrelease',
'motherboard',
'serialnumber',
'timezone',
'manufacturer',
'kernelversion',
'osservicepack',
'virtual',
'productname',
'osfullname',
'osmanufacturer',
'osversion',
'windowsdomain']
for key in keys:
self.assertIn(key, grains)
@skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
def test_gnu_slash_linux_in_os_name(self):
'''