mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #34684 from rallytime/merge-develop
[develop] Merge forward from 2016.3 to develop
This commit is contained in:
commit
41011d2fe5
@ -176,13 +176,13 @@ and all changes made.
|
||||
1. The ``.sls`` is discarded (i.e. ``webserver.sls`` becomes
|
||||
``webserver``).
|
||||
2. Subdirectories can be used for better organization.
|
||||
a. Each subdirectory can be represented with a dot (following the python
|
||||
import model) or a slash. ``webserver/dev.sls`` can also be referred to
|
||||
as ``webserver.dev``
|
||||
b. Because slashes can be represented as dots, SLS files can not contain
|
||||
dots in the name besides the dot for the SLS suffix. The SLS file
|
||||
webserver_1.0.sls can not be matched, and webserver_1.0 would match
|
||||
the directory/file webserver_1/0.sls
|
||||
a. Each subdirectory is represented with a dot (following the Python
|
||||
import model) in Salt states and on the command line . ``webserver/dev.sls``
|
||||
on the filesystem is referred to as ``webserver.dev`` in Salt
|
||||
b. Because slashes are represented as dots, SLS files can not contain
|
||||
dots in the name (other than the dot for the SLS suffix). The SLS
|
||||
file ``webserver_1.0.sls`` can not be matched, and ``webserver_1.0``
|
||||
would match the directory/file ``webserver_1/0.sls``
|
||||
|
||||
3. A file called ``init.sls`` in a subdirectory is referred to by the path
|
||||
of the directory. So, ``webserver/init.sls`` is referred to as
|
||||
|
@ -542,8 +542,12 @@ def __virtual__():
|
||||
Only load if docker libs are present
|
||||
'''
|
||||
if HAS_DOCKER_PY:
|
||||
docker_py_versioninfo = _get_docker_py_versioninfo()
|
||||
|
||||
try:
|
||||
docker_py_versioninfo = _get_docker_py_versioninfo()
|
||||
except Exception:
|
||||
# May fail if we try to connect to a docker daemon but can't
|
||||
return (False, 'Docker module found, but no version could be'
|
||||
' extracted')
|
||||
# Don't let a failure to interpret the version keep this module from
|
||||
# loading. Log a warning (log happens in _get_docker_py_versioninfo()).
|
||||
if docker_py_versioninfo is None:
|
||||
@ -552,7 +556,7 @@ def __virtual__():
|
||||
if docker_py_versioninfo >= MIN_DOCKER_PY:
|
||||
try:
|
||||
docker_versioninfo = version().get('VersionInfo')
|
||||
except CommandExecutionError:
|
||||
except Exception:
|
||||
docker_versioninfo = None
|
||||
|
||||
if docker_versioninfo is None or docker_versioninfo >= MIN_DOCKER:
|
||||
|
@ -2,8 +2,9 @@
|
||||
'''
|
||||
Test the salt mine system
|
||||
'''
|
||||
# Import Pytohn libs
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
import time
|
||||
|
||||
# Import Salt Testing libs
|
||||
from salttesting.helpers import ensure_in_syspath
|
||||
@ -83,6 +84,8 @@ class MineTest(integration.ModuleCase):
|
||||
minion_tgt=minion_id
|
||||
)
|
||||
)
|
||||
time.sleep(1)
|
||||
for minion_id in ('minion', 'sub_minion'):
|
||||
ret = self.run_function(
|
||||
'mine.get',
|
||||
[minion_id, 'grains.items'],
|
||||
|
@ -14,6 +14,7 @@ ensure_in_syspath('../../')
|
||||
|
||||
# Import salt libs
|
||||
import integration
|
||||
import salt.utils
|
||||
from salt.modules import mysql as mysqlmod
|
||||
|
||||
# Import 3rd-party libs
|
||||
@ -28,6 +29,9 @@ try:
|
||||
except Exception:
|
||||
NO_MYSQL = True
|
||||
|
||||
if not salt.utils.which('mysqladmin'):
|
||||
NO_MYSQL = True
|
||||
|
||||
|
||||
@skipIf(
|
||||
NO_MYSQL,
|
||||
|
@ -27,44 +27,25 @@ class NetworkTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
if os_family not in ('RedHat', 'Debian'):
|
||||
self.skipTest('Network state only supported on RedHat and Debian based systems')
|
||||
|
||||
self.run_function('cmd.run', ['ip link add name dummy0 type dummy'])
|
||||
|
||||
def tearDown(self):
|
||||
self.run_function('cmd.run', ['ip link delete dev dummy0'])
|
||||
|
||||
def test_managed(self):
|
||||
'''
|
||||
network.managed
|
||||
'''
|
||||
if_name = 'dummy0'
|
||||
ipaddr = '10.1.0.1'
|
||||
netmask = '255.255.255.0'
|
||||
broadcast = '10.1.0.255'
|
||||
state_key = 'network_|-dummy0_|-dummy0_|-managed'
|
||||
|
||||
expected_if_ret = [{
|
||||
"broadcast": broadcast,
|
||||
"netmask": netmask,
|
||||
"label": if_name,
|
||||
"address": ipaddr
|
||||
}]
|
||||
|
||||
ret = self.run_function('state.sls', mods='network.managed')
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
interface = self.run_function('network.interface', [if_name])
|
||||
self.assertEqual(interface, expected_if_ret)
|
||||
ret = self.run_function('state.sls', mods='network.managed', test=True)
|
||||
self.assertEqual('Interface dummy0 is set to be added.', ret[state_key]['comment'])
|
||||
|
||||
def test_routes(self):
|
||||
'''
|
||||
network.routes
|
||||
'''
|
||||
state_key = 'network_|-routes_|-dummy0_|-routes'
|
||||
expected_changes = {'network_routes': 'Added interface dummy0 routes.'}
|
||||
expected_changes = 'Interface dummy0 routes are set to be added.'
|
||||
|
||||
ret = self.run_function('state.sls', mods='network.routes')
|
||||
ret = self.run_function('state.sls', mods='network.routes', test=True)
|
||||
|
||||
self.assertSaltTrueReturn(ret)
|
||||
self.assertEqual(ret[state_key]['changes'], expected_changes)
|
||||
self.assertEqual(ret[state_key]['comment'], 'Interface dummy0 routes are set to be added.')
|
||||
|
||||
def test_system(self):
|
||||
'''
|
||||
@ -72,10 +53,8 @@ class NetworkTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
'''
|
||||
state_key = 'network_|-system_|-system_|-system'
|
||||
|
||||
ret = self.run_function('state.sls', mods='network.system')
|
||||
|
||||
self.assertSaltTrueReturn(ret)
|
||||
self.assertIn('network_settings', ret[state_key]['changes'])
|
||||
ret = self.run_function('state.sls', mods='network.system', test=True)
|
||||
self.assertIn('Global network settings are set to be updated:', ret[state_key]['comment'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user