diff --git a/doc/topics/development/modules/index.rst b/doc/topics/development/modules/index.rst index bf000a70d1..e95a485759 100644 --- a/doc/topics/development/modules/index.rst +++ b/doc/topics/development/modules/index.rst @@ -130,7 +130,7 @@ Cloud ``salt.cloud.clouds`` (:ref:`index `) `` Engine ``salt.engines`` (:ref:`index `) ``engines`` ``engines_dirs`` Execution ``salt.modules`` (:ref:`index `) ``modules`` ``module_dirs`` Executor ``salt.executors`` (:ref:`index `) ``executors`` [#no-fs]_ ``executor_dirs`` -File Server ``salt.fileserver`` (:ref:`index `) ``fileserver`` [#no-fs]_ ``fileserver_dirs`` +File Server ``salt.fileserver`` (:ref:`index `) ``fileserver`` ``fileserver_dirs`` Grain ``salt.grains`` (:ref:`index `) ``grains`` ``grains_dirs`` Log Handler ``salt.log.handlers`` (:ref:`index `) ``log_handlers`` ``log_handlers_dirs`` Net API ``salt.netapi`` (:ref:`index `) ``netapi`` [#no-fs]_ ``netapi_dirs`` @@ -143,13 +143,13 @@ Returner ``salt.returners`` (:ref:`index `) `` Roster ``salt.roster`` (:ref:`index `) ``roster`` ``roster_dirs`` Runner ``salt.runners`` (:ref:`index `) ``runners`` ``runner_dirs`` SDB ``salt.sdb`` (:ref:`index `) ``sdb`` ``sdb_dirs`` -Search ``salt.search`` ``search`` [#no-fs]_ ``search_dirs`` Serializer ``salt.serializers`` (:ref:`index `) ``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 `) ``states`` ``states_dirs`` -Thorium ``salt.thorium`` (:ref:`index `) ``thorium`` [#no-fs]_ ``thorium_dirs`` +Thorium ``salt.thorium`` (:ref:`index `) ``thorium`` ``thorium_dirs`` +Tokens ``salt.tokens`` ``tokens`` ``tokens_dirs`` Top ``salt.tops`` (:ref:`index `) ``tops`` ``top_dirs`` Util ``salt.utils`` ``utils`` ``utils_dirs`` Wheel ``salt.wheels`` (:ref:`index `) ``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 `. -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 ` event reactor. +Tokens +------ + +Token stores for :ref:`External Authentication `. See the +:py:mod:`salt.tokens` docstring for details. + +.. note: + The runner to load tokens modules is + :py:func:`saltutil.sync_eauth_tokens `. + Tops ---- diff --git a/salt/modules/artifactory.py b/salt/modules/artifactory.py index 18acfa5ee1..3467a0e369 100644 --- a/salt/modules/artifactory.py +++ b/salt/modules/artifactory.py @@ -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 diff --git a/salt/returners/zabbix_return.py b/salt/returners/zabbix_return.py index f5747b389f..edb4eccbd0 100644 --- a/salt/returners/zabbix_return.py +++ b/salt/returners/zabbix_return.py @@ -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)) diff --git a/salt/utils/stringutils.py b/salt/utils/stringutils.py index 3a21d11cfd..50f6bd4f32 100644 --- a/salt/utils/stringutils.py +++ b/salt/utils/stringutils.py @@ -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 = '\'' diff --git a/tests/integration/files/file/base/issue-51208.sls b/tests/integration/files/file/base/issue-51208.sls new file mode 100644 index 0000000000..fb23d2ce6e --- /dev/null +++ b/tests/integration/files/file/base/issue-51208.sls @@ -0,0 +1,4 @@ +/tmp/vimrc: + file.append: + - sources: + - salt://test/files/vimrc.stub diff --git a/tests/integration/files/file/base/issue-51208/vimrc.stub b/tests/integration/files/file/base/issue-51208/vimrc.stub new file mode 100644 index 0000000000..b2f3f67baf --- /dev/null +++ b/tests/integration/files/file/base/issue-51208/vimrc.stub @@ -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 + diff --git a/tests/integration/states/test_file.py b/tests/integration/states/test_file.py index d48ec39bbf..04d182c0cf 100644 --- a/tests/integration/states/test_file.py +++ b/tests/integration/states/test_file.py @@ -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'