mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2018.3' into 'fluorine'
No conflicts.
This commit is contained in:
commit
9298304ce9
15 changed files with 44 additions and 44 deletions
|
@ -66,6 +66,7 @@ MOCK_MODULES = [
|
|||
'user',
|
||||
|
||||
# salt core
|
||||
'concurrent',
|
||||
'Crypto',
|
||||
'Crypto.Signature',
|
||||
'Crypto.Cipher',
|
||||
|
|
|
@ -137,7 +137,7 @@ call functions available in other execution modules.
|
|||
The variable ``__salt__`` is packed into the modules after they are loaded into
|
||||
the Salt minion.
|
||||
|
||||
The ``__salt__`` variable is a :ref:`Python dictionary <typesmapping>`
|
||||
The ``__salt__`` variable is a :ref:`Python dictionary <python:typesmapping>`
|
||||
containing all of the Salt functions. Dictionary keys are strings representing
|
||||
the names of the modules and the values are the functions themselves.
|
||||
|
||||
|
@ -176,7 +176,7 @@ Grains Data
|
|||
-----------
|
||||
|
||||
The values detected by the Salt Grains on the minion are available in a
|
||||
:ref:`Python dictionary <typesmapping>` named ``__grains__`` and can be
|
||||
:ref:`Python dictionary <python:typesmapping>` named ``__grains__`` and can be
|
||||
accessed from within callable objects in the Python modules.
|
||||
|
||||
To see the contents of the grains dictionary for a given system in your
|
||||
|
@ -288,7 +288,7 @@ Virtual module names are set using the ``__virtual__`` function and the
|
|||
``__virtual__`` Function
|
||||
========================
|
||||
|
||||
The ``__virtual__`` function returns either a :ref:`string <typesseq>`,
|
||||
The ``__virtual__`` function returns either a :ref:`string <python:typesseq>`,
|
||||
:py:data:`True`, :py:data:`False`, or :py:data:`False` with an :ref:`error
|
||||
string <modules-error-info>`. If a string is returned then the module is loaded
|
||||
using the name of the string as the virtual name. If ``True`` is returned the
|
||||
|
|
|
@ -193,7 +193,7 @@ functions available in other state modules.
|
|||
The variable ``__states__`` is packed into the modules after they are loaded into
|
||||
the Salt minion.
|
||||
|
||||
The ``__states__`` variable is a :ref:`Python dictionary <typesmapping>`
|
||||
The ``__states__`` variable is a :ref:`Python dictionary <python:typesmapping>`
|
||||
containing all of the state modules. Dictionary keys are strings representing
|
||||
the names of the modules and the values are the functions themselves.
|
||||
|
||||
|
|
|
@ -130,8 +130,8 @@ The grains are derived by executing all of the "public" functions (i.e. those
|
|||
which do not begin with an underscore) found in the modules located in the
|
||||
Salt's core grains code, followed by those in any custom grains modules. The
|
||||
functions in a grains module must return a :ref:`Python dictionary
|
||||
<typesmapping>`, where the dictionary keys are the names of grains, and each
|
||||
key's value is that value for that grain.
|
||||
<python:typesmapping>`, where the dictionary keys are the names of grains, and
|
||||
each key's value is that value for that grain.
|
||||
|
||||
Custom grains modules should be placed in a subdirectory named ``_grains``
|
||||
located under the :conf_master:`file_roots` specified by the master config
|
||||
|
|
|
@ -177,7 +177,7 @@ Saltstack extends `builtin filters`_ with these custom filters:
|
|||
|
||||
Converts any time related object into a time based string. It requires valid
|
||||
strftime directives. An exhaustive list can be found :ref:`here
|
||||
<strftime-strptime-behavior>` in the Python documentation.
|
||||
<python:strftime-strptime-behavior>` in the Python documentation.
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@ import salt.utils.hashutils
|
|||
import salt.utils.stringutils
|
||||
|
||||
if six.PY2:
|
||||
import StringIO
|
||||
from StringIO import StringIO
|
||||
BytesIO = StringIO
|
||||
elif six.PY3:
|
||||
from io import StringIO
|
||||
from io import BytesIO, StringIO
|
||||
|
||||
|
||||
def digest(instr, checksum='md5'):
|
||||
|
@ -155,13 +156,13 @@ def base64_encodefile(fname):
|
|||
|
||||
salt '*' hashutil.base64_encodefile /path/to/binary_file
|
||||
'''
|
||||
encoded_f = StringIO.StringIO()
|
||||
encoded_f = BytesIO()
|
||||
|
||||
with salt.utils.files.fopen(fname, 'rb') as f:
|
||||
base64.encode(f, encoded_f)
|
||||
|
||||
encoded_f.seek(0)
|
||||
return encoded_f.read()
|
||||
return salt.utils.stringutils.to_str(encoded_f.read())
|
||||
|
||||
|
||||
def base64_decodestring(instr):
|
||||
|
@ -192,7 +193,7 @@ def base64_decodefile(instr, outfile):
|
|||
|
||||
salt '*' hashutil.base64_decodefile instr='Z2V0IHNhbHRlZAo=' outfile='/path/to/binary_file'
|
||||
'''
|
||||
encoded_f = StringIO.StringIO(instr)
|
||||
encoded_f = StringIO(instr)
|
||||
|
||||
with salt.utils.files.fopen(outfile, 'wb') as f:
|
||||
base64.decode(encoded_f, f)
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Execute a command and read the output as YAMLEX. The YAMLEX data is then
|
||||
directly overlaid onto the minion's Pillar data
|
||||
Execute a command and read the output as YAMLEX.
|
||||
|
||||
The YAMLEX data is then directly overlaid onto the minion's Pillar data
|
||||
'''
|
||||
|
||||
# Don't "fix" the above docstring to put it on two lines, as the sphinx
|
||||
# autosummary pulls only the first line for its description.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
|
|
|
@ -103,7 +103,7 @@ would actually end up in pillar after all merging was complete:
|
|||
- baz
|
||||
|
||||
MakoStack configuration files
|
||||
-------------------------------
|
||||
-----------------------------
|
||||
|
||||
The config files that are referenced in the above ``ext_pillar`` configuration
|
||||
are mako templates which must render as a simple ordered list of ``yaml``
|
||||
|
|
|
@ -12,7 +12,7 @@ This module is a concrete implementation of the sql_base ext_pillar for MySQL.
|
|||
:platform: all
|
||||
|
||||
Configuring the mysql ext_pillar
|
||||
=====================================
|
||||
================================
|
||||
|
||||
Use the 'mysql' key under ext_pillar for configuration of queries.
|
||||
|
||||
|
@ -22,7 +22,7 @@ mysql.pass, mysql.port, mysql.host) for database connection info.
|
|||
Required python modules: MySQLdb
|
||||
|
||||
Complete example
|
||||
=====================================
|
||||
================
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ Retrieve Pillar data by doing a postgres query
|
|||
:depends: psycopg2
|
||||
:platform: all
|
||||
|
||||
Complete example
|
||||
=====================================
|
||||
Complete Example
|
||||
================
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ It exposes a python ABC that can be subclassed for new database providers.
|
|||
:platform: all
|
||||
|
||||
Theory of sql_base ext_pillar
|
||||
=====================================
|
||||
=============================
|
||||
|
||||
Ok, here's the theory for how this works...
|
||||
|
||||
|
@ -32,7 +32,7 @@ You can retrieve as many fields as you like, how they get used depends on the
|
|||
exact settings.
|
||||
|
||||
Configuring a sql_base ext_pillar
|
||||
=====================================
|
||||
=================================
|
||||
|
||||
The sql_base ext_pillar cannot be used directly, but shares query configuration
|
||||
with its implementations. These examples use a fake 'sql_base' adapter, which
|
||||
|
|
|
@ -37,8 +37,8 @@ Example configuration
|
|||
pass: strong_pass_phrase
|
||||
timeout: 5.0
|
||||
|
||||
Complete example
|
||||
=================
|
||||
Complete Example
|
||||
================
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
|
|
|
@ -340,6 +340,7 @@ class OrchEventTest(ShellCase):
|
|||
self.conf.write(salt.utils.yaml.safe_dump(data, default_flow_style=False))
|
||||
self.conf.flush()
|
||||
|
||||
@expensiveTest
|
||||
def test_jid_in_ret_event(self):
|
||||
'''
|
||||
Test to confirm that the ret event for the orchestration contains the
|
||||
|
|
|
@ -11,6 +11,7 @@ import os
|
|||
import sys
|
||||
import time
|
||||
import warnings
|
||||
import collections
|
||||
|
||||
TESTS_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
|
||||
if os.name == 'nt':
|
||||
|
@ -97,7 +98,7 @@ MAX_OPEN_FILES = {
|
|||
|
||||
# Combine info from command line options and test suite directories. A test
|
||||
# suite is a python package of test modules relative to the tests directory.
|
||||
TEST_SUITES = {
|
||||
TEST_SUITES_UNORDERED = {
|
||||
'unit':
|
||||
{'display_name': 'Unit',
|
||||
'path': 'unit'},
|
||||
|
@ -187,6 +188,9 @@ TEST_SUITES = {
|
|||
'path': 'integration/logging'},
|
||||
}
|
||||
|
||||
TEST_SUITES = collections.OrderedDict(sorted(TEST_SUITES_UNORDERED.items(),
|
||||
key=lambda x: x[0]))
|
||||
|
||||
|
||||
class SaltTestsuiteParser(SaltCoverageTestingParser):
|
||||
support_docker_execution = True
|
||||
|
|
|
@ -841,28 +841,24 @@ class StateTestCase(TestCase, LoaderModuleMockMixin):
|
|||
Test to clear out the state execution request without executing it
|
||||
'''
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os.path, 'join', mock):
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(salt.payload, 'Serial', mock):
|
||||
mock = MagicMock(side_effect=[False, True, True])
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
self.assertTrue(state.clear_request("A"))
|
||||
with patch.object(salt.payload, 'Serial', mock):
|
||||
mock = MagicMock(side_effect=[False, True, True])
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
self.assertTrue(state.clear_request("A"))
|
||||
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os, 'remove', mock):
|
||||
self.assertTrue(state.clear_request())
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os, 'remove', mock):
|
||||
self.assertTrue(state.clear_request())
|
||||
|
||||
mock = MagicMock(return_value={})
|
||||
with patch.object(state, 'check_request', mock):
|
||||
self.assertFalse(state.clear_request("A"))
|
||||
mock = MagicMock(return_value={})
|
||||
with patch.object(state, 'check_request', mock):
|
||||
self.assertFalse(state.clear_request("A"))
|
||||
|
||||
def test_check_request(self):
|
||||
'''
|
||||
Test to return the state request information
|
||||
'''
|
||||
mock = MagicMock(return_value=True)
|
||||
with patch.object(os.path, 'join', mock), \
|
||||
patch('salt.modules.state.salt.payload', MockSerial):
|
||||
with patch('salt.modules.state.salt.payload', MockSerial):
|
||||
mock = MagicMock(side_effect=[True, True, False])
|
||||
with patch.object(os.path, 'isfile', mock):
|
||||
with patch('salt.utils.files.fopen', mock_open()):
|
||||
|
|
Loading…
Add table
Reference in a new issue