Merge branch '2019.2' into fix_test_symlink_2019.2

This commit is contained in:
Shane Lee 2019-04-08 13:37:18 -06:00 committed by GitHub
commit a429542e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 8 deletions

View File

@ -289,7 +289,7 @@ a BGP policy referenced in many places, you can do so by running:
.. code-block:: bash
salt '*' net.replae_pattern OLD-POLICY-CONFIG new-policy-config
salt '*' net.replace_pattern OLD-POLICY-CONFIG new-policy-config
Similarly, you can also replace entire configuration blocks using the
:mod:`net.blockreplace <salt.modules.napalm_network.blockreplace>` function.

View File

@ -2141,6 +2141,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

@ -136,6 +136,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):
'''

View File

@ -197,9 +197,12 @@ class SampleConfTest(TestCase):
commented out. This test loops through all of the files in that directory to check
for any lines that are not commented or blank.
'''
cloud_sample_files = os.listdir(SAMPLE_CONF_DIR + 'cloud.profiles.d/')
cloud_sample_dir = SAMPLE_CONF_DIR + 'cloud.profiles.d/'
if not os.path.exists(cloud_sample_dir):
self.skipTest("Sample config directory '{}' is missing.".format(cloud_sample_dir))
cloud_sample_files = os.listdir(cloud_sample_dir)
for conf_file in cloud_sample_files:
profile_conf = SAMPLE_CONF_DIR + 'cloud.profiles.d/' + conf_file
profile_conf = cloud_sample_dir + conf_file
ret = salt.config._read_conf_file(profile_conf)
self.assertEqual(
ret,
@ -215,9 +218,12 @@ class SampleConfTest(TestCase):
commented out. This test loops through all of the files in that directory to check
for any lines that are not commented or blank.
'''
cloud_sample_files = os.listdir(SAMPLE_CONF_DIR + 'cloud.providers.d/')
cloud_sample_dir = SAMPLE_CONF_DIR + 'cloud.providers.d/'
if not os.path.exists(cloud_sample_dir):
self.skipTest("Sample config directory '{}' is missing.".format(cloud_sample_dir))
cloud_sample_files = os.listdir(cloud_sample_dir)
for conf_file in cloud_sample_files:
provider_conf = SAMPLE_CONF_DIR + 'cloud.providers.d/' + conf_file
provider_conf = cloud_sample_dir + conf_file
ret = salt.config._read_conf_file(provider_conf)
self.assertEqual(
ret,
@ -233,9 +239,12 @@ class SampleConfTest(TestCase):
commented out. This test loops through all of the files in that directory to check
for any lines that are not commented or blank.
'''
cloud_sample_files = os.listdir(SAMPLE_CONF_DIR + 'cloud.maps.d/')
cloud_sample_dir = SAMPLE_CONF_DIR + 'cloud.maps.d/'
if not os.path.exists(cloud_sample_dir):
self.skipTest("Sample config directory '{}' is missing.".format(cloud_sample_dir))
cloud_sample_files = os.listdir(cloud_sample_dir)
for conf_file in cloud_sample_files:
map_conf = SAMPLE_CONF_DIR + 'cloud.maps.d/' + conf_file
map_conf = cloud_sample_dir + conf_file
ret = salt.config._read_conf_file(map_conf)
self.assertEqual(
ret,

View File

@ -14,7 +14,7 @@ import shutil
from datetime import date
# Import Salt Testing libs
from tests.support.unit import TestCase
from tests.support.unit import TestCase, skipIf
from tests.support.mock import MagicMock, patch
# Import salt libs
@ -35,6 +35,8 @@ class ExtendTestCase(TestCase):
shutil.rmtree(self.out, True)
os.chdir(self.starting_dir)
@skipIf(not os.path.exists(os.path.join(integration.CODE_DIR, 'templates')),
"Test template directory 'templates/' missing.")
def test_run(self):
with patch('sys.exit', MagicMock):
out = salt.utils.extend.run('test', 'test', 'this description', integration.CODE_DIR, False)