Merge branch '2018.3' into merge-2018.3

This commit is contained in:
Gareth J. Greenaway 2019-01-22 18:22:11 -08:00 committed by GitHub
commit 44ddc43ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 37 deletions

View File

@ -130,7 +130,7 @@ Cloud ``salt.cloud.clouds`` (:ref:`index <all-salt.clouds>`) ``
Engine ``salt.engines`` (:ref:`index <engines>`) ``engines`` ``engines_dirs`` Engine ``salt.engines`` (:ref:`index <engines>`) ``engines`` ``engines_dirs``
Execution ``salt.modules`` (:ref:`index <all-salt.modules>`) ``modules`` ``module_dirs`` Execution ``salt.modules`` (:ref:`index <all-salt.modules>`) ``modules`` ``module_dirs``
Executor ``salt.executors`` (:ref:`index <all-salt.executors>`) ``executors`` [#no-fs]_ ``executor_dirs`` Executor ``salt.executors`` (:ref:`index <all-salt.executors>`) ``executors`` [#no-fs]_ ``executor_dirs``
File Server ``salt.fileserver`` (:ref:`index <file-server>`) ``fileserver`` [#no-fs]_ ``fileserver_dirs`` File Server ``salt.fileserver`` (:ref:`index <file-server>`) ``fileserver`` ``fileserver_dirs``
Grain ``salt.grains`` (:ref:`index <all-salt.grains>`) ``grains`` ``grains_dirs`` Grain ``salt.grains`` (:ref:`index <all-salt.grains>`) ``grains`` ``grains_dirs``
Log Handler ``salt.log.handlers`` (:ref:`index <external-logging-handlers>`) ``log_handlers`` ``log_handlers_dirs`` Log Handler ``salt.log.handlers`` (:ref:`index <external-logging-handlers>`) ``log_handlers`` ``log_handlers_dirs``
Net API ``salt.netapi`` (:ref:`index <all-netapi-modules>`) ``netapi`` [#no-fs]_ ``netapi_dirs`` Net API ``salt.netapi`` (:ref:`index <all-netapi-modules>`) ``netapi`` [#no-fs]_ ``netapi_dirs``
@ -143,13 +143,13 @@ Returner ``salt.returners`` (:ref:`index <all-salt.returners>`) ``
Roster ``salt.roster`` (:ref:`index <all-salt.roster>`) ``roster`` ``roster_dirs`` Roster ``salt.roster`` (:ref:`index <all-salt.roster>`) ``roster`` ``roster_dirs``
Runner ``salt.runners`` (:ref:`index <all-salt.runners>`) ``runners`` ``runner_dirs`` Runner ``salt.runners`` (:ref:`index <all-salt.runners>`) ``runners`` ``runner_dirs``
SDB ``salt.sdb`` (:ref:`index <all-salt.sdb>`) ``sdb`` ``sdb_dirs`` SDB ``salt.sdb`` (:ref:`index <all-salt.sdb>`) ``sdb`` ``sdb_dirs``
Search ``salt.search`` ``search`` [#no-fs]_ ``search_dirs``
Serializer ``salt.serializers`` (:ref:`index <all-salt.serializers>`) ``serializers`` [#no-fs]_ ``serializers_dirs`` Serializer ``salt.serializers`` (:ref:`index <all-salt.serializers>`) ``serializers`` [#no-fs]_ ``serializers_dirs``
SPM pkgdb ``salt.spm.pkgdb`` ``pkgdb`` [#no-fs]_ ``pkgdb_dirs`` SPM pkgdb ``salt.spm.pkgdb`` ``pkgdb`` [#no-fs]_ ``pkgdb_dirs``
SPM pkgfiles ``salt.spm.pkgfiles`` ``pkgfiles`` [#no-fs]_ ``pkgfiles_dirs`` SPM pkgfiles ``salt.spm.pkgfiles`` ``pkgfiles`` [#no-fs]_ ``pkgfiles_dirs``
SSH Wrapper ``salt.client.ssh.wrapper`` ``wrapper`` [#no-fs]_ ``wrapper_dirs`` SSH Wrapper ``salt.client.ssh.wrapper`` ``wrapper`` [#no-fs]_ ``wrapper_dirs``
State ``salt.states`` (:ref:`index <all-salt.states>`) ``states`` ``states_dirs`` State ``salt.states`` (:ref:`index <all-salt.states>`) ``states`` ``states_dirs``
Thorium ``salt.thorium`` (:ref:`index <all-salt.thorium>`) ``thorium`` [#no-fs]_ ``thorium_dirs`` Thorium ``salt.thorium`` (:ref:`index <all-salt.thorium>`) ``thorium`` ``thorium_dirs``
Tokens ``salt.tokens`` ``tokens`` ``tokens_dirs``
Top ``salt.tops`` (:ref:`index <all-salt.tops>`) ``tops`` ``top_dirs`` Top ``salt.tops`` (:ref:`index <all-salt.tops>`) ``tops`` ``top_dirs``
Util ``salt.utils`` ``utils`` ``utils_dirs`` Util ``salt.utils`` ``utils`` ``utils_dirs``
Wheel ``salt.wheels`` (:ref:`index <all-salt.wheel>`) ``wheel`` ``wheel_dirs`` Wheel ``salt.wheels`` (:ref:`index <all-salt.wheel>`) ``wheel`` ``wheel_dirs``
@ -223,6 +223,12 @@ object.
Executor Executor
-------- --------
.. toctree::
:maxdepth: 1
:glob:
/ref/executors/index
Executors control how execution modules get called. The default is to just call Executors control how execution modules get called. The default is to just call
them, but this can be customized. them, but this can be customized.
@ -322,11 +328,6 @@ SDB
SDB is a way to store data that's not associated with a minion. See SDB is a way to store data that's not associated with a minion. See
:ref:`Storing Data in Other Databases <sdb>`. :ref:`Storing Data in Other Databases <sdb>`.
Search
------
A system for indexing the file server and pillars. Removed in 2018.3.
Serializer Serializer
---------- ----------
@ -375,6 +376,16 @@ Thorium
Modules for use in the :ref:`Thorium <thorium-reactor>` event reactor. Modules for use in the :ref:`Thorium <thorium-reactor>` event reactor.
Tokens
------
Token stores for :ref:`External Authentication <acl-eauth>`. See the
:py:mod:`salt.tokens` docstring for details.
.. note:
The runner to load tokens modules is
:py:func:`saltutil.sync_eauth_tokens <salt.runners.saltutil.sync_eauth_tokens>`.
Tops Tops
---- ----

View File

@ -388,6 +388,9 @@ def _get_snapshot_version_metadata(artifactory_url, repository, group_id, artifa
extension = snapshot_version.find('extension').text extension = snapshot_version.find('extension').text
value = snapshot_version.find('value').text value = snapshot_version.find('value').text
extension_version_dict[extension] = value extension_version_dict[extension] = value
if snapshot_version.find('classifier') is not None:
classifier = snapshot_version.find('classifier').text
extension_version_dict[classifier] = value
return { return {
'snapshot_versions': extension_version_dict 'snapshot_versions': extension_version_dict

View File

@ -7,10 +7,8 @@ The following Type: "Zabbix trapper" with "Type of information" Text items are r
.. code-block:: cfg .. code-block:: cfg
Key: salt.trap.info Key: salt.trap.info
Key: salt.trap.average
Key: salt.trap.warning Key: salt.trap.warning
Key: salt.trap.high Key: salt.trap.high
Key: salt.trap.disaster
To use the Zabbix returner, append '--return zabbix' to the salt command. ex: To use the Zabbix returner, append '--return zabbix' to the salt command. ex:
@ -21,15 +19,10 @@ To use the Zabbix returner, append '--return zabbix' to the salt command. ex:
# Import Python libs # Import Python libs
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import logging
import os import os
# Import Salt libs # Import Salt libs
from salt.ext import six from salt.ext import six
import salt.utils.files
# Get logging started
log = logging.getLogger(__name__)
# Define the module's virtual name # Define the module's virtual name
@ -55,37 +48,24 @@ def zbx():
return False return False
def zabbix_send(key, host, output): def zabbix_send(key, output):
with salt.utils.files.fopen(zbx()['zabbix_config'], 'r') as file_handle: cmd = zbx()['sender'] + " -c " + zbx()['config'] + " -k " + key + " -o \"" + output +"\""
for line in file_handle: __salt__['cmd.shell'](cmd)
if "ServerActive" in line:
flag = "true"
server = line.rsplit('=')
server = server[1].rsplit(',')
for s in server:
cmd = zbx()['sender'] + " -z " + s.replace('\n', '') + " -s " + host + " -k " + key + " -o \"" + output +"\""
__salt__['cmd.shell'](cmd)
break
else:
flag = "false"
if flag == 'false':
cmd = zbx()['sender'] + " -c " + zbx()['config'] + " -s " + host + " -k " + key + " -o \"" + output +"\""
def returner(ret): def returner(ret):
changes = False changes = False
errors = False errors = False
job_minion_id = ret['id'] job_minion_id = ret['id']
host = job_minion_id
if type(ret['return']) is dict: if type(ret['return']) is dict:
for state, item in six.iteritems(ret['return']): for state, item in six.iteritems(ret['return']):
if 'comment' in item and 'name' in item and not item['result']: if 'comment' in item and 'name' in item and item['result'] is False:
errors = True errors = True
zabbix_send("salt.trap.high", host, 'SALT:\nname: {0}\ncomment: {1}'.format(item['name'], item['comment'])) zabbix_send("salt.trap.high", 'SALT:\nname: {0}\ncomment: {1}'.format(item['name'], item['comment']))
if 'comment' in item and 'name' in item and item['changes']: elif 'comment' in item and 'name' in item and item['changes']:
changes = True changes = True
zabbix_send("salt.trap.warning", host, 'SALT:\nname: {0}\ncomment: {1}'.format(item['name'], item['comment'])) zabbix_send("salt.trap.warning", 'SALT:\nname: {0}\ncomment: {1}'.format(item['name'], item['comment']))
if not changes and not errors: if not changes and not errors:
zabbix_send("salt.trap.info", host, 'SALT {0} OK'.format(job_minion_id)) zabbix_send("salt.trap.info", 'SALT {0} OK'.format(job_minion_id))

View File

@ -333,7 +333,9 @@ def build_whitespace_split_regex(text):
lexer = shlex.shlex(text) lexer = shlex.shlex(text)
lexer.whitespace_split = True lexer.whitespace_split = True
lexer.commenters = '' lexer.commenters = ''
if '\'' in text: if r"'\"" in text:
lexer.quotes = ''
elif '\'' in text:
lexer.quotes = '"' lexer.quotes = '"'
elif '"' in text: elif '"' in text:
lexer.quotes = '\'' lexer.quotes = '\''

View File

@ -0,0 +1,4 @@
/tmp/vimrc:
file.append:
- sources:
- salt://test/files/vimrc.stub

View File

@ -0,0 +1,8 @@
set number
syntax on
set paste
set ruler
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

View File

@ -2530,6 +2530,22 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
'', '',
]).encode('utf-8')) ]).encode('utf-8'))
def test_managed_file_issue_51208(self):
'''
Test to ensure we can handle a file with escaped double-quotes
'''
name = os.path.join(TMP, 'issue_51208.txt')
ret = self.run_state(
'file.managed', name=name, source='salt://issue-51208/vimrc.stub'
)
src = os.path.join(BASE_FILES, 'issue-51208', 'vimrc.stub')
with salt.utils.files.fopen(src, 'r') as fp_:
master_data = fp_.read()
with salt.utils.files.fopen(name, 'r') as fp_:
minion_data = fp_.read()
self.assertEqual(master_data, minion_data)
self.assertSaltTrueReturn(ret)
class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin): class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
marker_start = '# start' marker_start = '# start'