mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge branch '2018.3' into merge-2018.3
This commit is contained in:
commit
44ddc43ce9
@ -130,7 +130,7 @@ Cloud ``salt.cloud.clouds`` (:ref:`index <all-salt.clouds>`) ``
|
||||
Engine ``salt.engines`` (:ref:`index <engines>`) ``engines`` ``engines_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``
|
||||
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``
|
||||
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``
|
||||
@ -143,13 +143,13 @@ Returner ``salt.returners`` (:ref:`index <all-salt.returners>`) ``
|
||||
Roster ``salt.roster`` (:ref:`index <all-salt.roster>`) ``roster`` ``roster_dirs``
|
||||
Runner ``salt.runners`` (:ref:`index <all-salt.runners>`) ``runners`` ``runner_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``
|
||||
SPM pkgdb ``salt.spm.pkgdb`` ``pkgdb`` [#no-fs]_ ``pkgdb_dirs``
|
||||
SPM pkgfiles ``salt.spm.pkgfiles`` ``pkgfiles`` [#no-fs]_ ``pkgfiles_dirs``
|
||||
SSH Wrapper ``salt.client.ssh.wrapper`` ``wrapper`` [#no-fs]_ ``wrapper_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``
|
||||
Util ``salt.utils`` ``utils`` ``utils_dirs``
|
||||
Wheel ``salt.wheels`` (:ref:`index <all-salt.wheel>`) ``wheel`` ``wheel_dirs``
|
||||
@ -223,6 +223,12 @@ object.
|
||||
Executor
|
||||
--------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:glob:
|
||||
|
||||
/ref/executors/index
|
||||
|
||||
Executors control how execution modules get called. The default is to just call
|
||||
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
|
||||
:ref:`Storing Data in Other Databases <sdb>`.
|
||||
|
||||
Search
|
||||
------
|
||||
|
||||
A system for indexing the file server and pillars. Removed in 2018.3.
|
||||
|
||||
Serializer
|
||||
----------
|
||||
|
||||
@ -375,6 +376,16 @@ Thorium
|
||||
|
||||
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
|
||||
----
|
||||
|
||||
|
@ -388,6 +388,9 @@ def _get_snapshot_version_metadata(artifactory_url, repository, group_id, artifa
|
||||
extension = snapshot_version.find('extension').text
|
||||
value = snapshot_version.find('value').text
|
||||
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 {
|
||||
'snapshot_versions': extension_version_dict
|
||||
|
@ -7,10 +7,8 @@ The following Type: "Zabbix trapper" with "Type of information" Text items are r
|
||||
.. code-block:: cfg
|
||||
|
||||
Key: salt.trap.info
|
||||
Key: salt.trap.average
|
||||
Key: salt.trap.warning
|
||||
Key: salt.trap.high
|
||||
Key: salt.trap.disaster
|
||||
|
||||
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
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import logging
|
||||
import os
|
||||
|
||||
# Import Salt libs
|
||||
from salt.ext import six
|
||||
import salt.utils.files
|
||||
|
||||
# Get logging started
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Define the module's virtual name
|
||||
@ -55,37 +48,24 @@ def zbx():
|
||||
return False
|
||||
|
||||
|
||||
def zabbix_send(key, host, output):
|
||||
with salt.utils.files.fopen(zbx()['zabbix_config'], 'r') as file_handle:
|
||||
for line in file_handle:
|
||||
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 zabbix_send(key, output):
|
||||
cmd = zbx()['sender'] + " -c " + zbx()['config'] + " -k " + key + " -o \"" + output +"\""
|
||||
__salt__['cmd.shell'](cmd)
|
||||
|
||||
|
||||
def returner(ret):
|
||||
changes = False
|
||||
errors = False
|
||||
job_minion_id = ret['id']
|
||||
host = job_minion_id
|
||||
|
||||
if type(ret['return']) is dict:
|
||||
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
|
||||
zabbix_send("salt.trap.high", host, 'SALT:\nname: {0}\ncomment: {1}'.format(item['name'], item['comment']))
|
||||
if 'comment' in item and 'name' in item and item['changes']:
|
||||
zabbix_send("salt.trap.high", 'SALT:\nname: {0}\ncomment: {1}'.format(item['name'], item['comment']))
|
||||
elif 'comment' in item and 'name' in item and item['changes']:
|
||||
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:
|
||||
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))
|
||||
|
@ -333,7 +333,9 @@ def build_whitespace_split_regex(text):
|
||||
lexer = shlex.shlex(text)
|
||||
lexer.whitespace_split = True
|
||||
lexer.commenters = ''
|
||||
if '\'' in text:
|
||||
if r"'\"" in text:
|
||||
lexer.quotes = ''
|
||||
elif '\'' in text:
|
||||
lexer.quotes = '"'
|
||||
elif '"' in text:
|
||||
lexer.quotes = '\''
|
||||
|
4
tests/integration/files/file/base/issue-51208.sls
Normal file
4
tests/integration/files/file/base/issue-51208.sls
Normal file
@ -0,0 +1,4 @@
|
||||
/tmp/vimrc:
|
||||
file.append:
|
||||
- sources:
|
||||
- salt://test/files/vimrc.stub
|
8
tests/integration/files/file/base/issue-51208/vimrc.stub
Normal file
8
tests/integration/files/file/base/issue-51208/vimrc.stub
Normal 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
|
||||
|
@ -2530,6 +2530,22 @@ class FileTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
'',
|
||||
]).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):
|
||||
marker_start = '# start'
|
||||
|
Loading…
Reference in New Issue
Block a user