mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #21207 from cro/2015-03-01-2014.7-2015.2
2015-03-01 Merge-forward 2014.7 to 2015.2
This commit is contained in:
commit
027a6d9899
@ -444,8 +444,12 @@ performance of max_minions.
|
|||||||
|
|
||||||
Default: False
|
Default: False
|
||||||
|
|
||||||
When enabled the master regularly sends events of currently connected, lost,
|
Causes the master to periodically look for actively connected minions.
|
||||||
and newly connected minions on the eventbus.
|
:ref:`Presence events <event-master_presence>` are fired on the event bus on a
|
||||||
|
regular interval with a list of connected minions, as well as events with lists
|
||||||
|
of newly connected or disconnected minions. This is a master-only operation
|
||||||
|
that does not send executions to minions. Note, this does not detect minions
|
||||||
|
that connect to a master via localhost.
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
@ -70,12 +70,16 @@ Job events
|
|||||||
:var fun: The function the minion ran. E.g., ``test.ping``.
|
:var fun: The function the minion ran. E.g., ``test.ping``.
|
||||||
:var return: The data returned from the execution module.
|
:var return: The data returned from the execution module.
|
||||||
|
|
||||||
|
.. _event-master_presence:
|
||||||
|
|
||||||
Presence events
|
Presence events
|
||||||
===============
|
===============
|
||||||
|
|
||||||
.. salt:event:: salt/presence/present
|
.. salt:event:: salt/presence/present
|
||||||
|
|
||||||
Fired on a set schedule.
|
Events fired on a regular interval about currently connected, newly
|
||||||
|
connected, or recently disconnected minions. Requires the
|
||||||
|
:conf_master:`presence_events` setting to be enabled.
|
||||||
|
|
||||||
:var present: A list of minions that are currently connected to the Salt
|
:var present: A list of minions that are currently connected to the Salt
|
||||||
master.
|
master.
|
||||||
|
5
tests/integration/files/file/base/script.py
Normal file
5
tests/integration/files/file/base/script.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
print(' '.join(sys.argv[1:]))
|
@ -3,11 +3,16 @@
|
|||||||
# Import python libs
|
# Import python libs
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import textwrap
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
# Import Salt Testing libs
|
# Import Salt Testing libs
|
||||||
from salttesting import skipIf
|
from salttesting import skipIf
|
||||||
from salttesting.helpers import ensure_in_syspath, skip_if_binaries_missing
|
from salttesting.helpers import (
|
||||||
|
destructiveTest,
|
||||||
|
ensure_in_syspath,
|
||||||
|
skip_if_binaries_missing
|
||||||
|
)
|
||||||
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, Mock, patch
|
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, Mock, patch
|
||||||
ensure_in_syspath('../../')
|
ensure_in_syspath('../../')
|
||||||
|
|
||||||
@ -151,6 +156,33 @@ class CMDModuleTest(integration.ModuleCase):
|
|||||||
self.assertEqual(self.run_function('cmd.retcode', ['exit 0'], python_shell=True), 0)
|
self.assertEqual(self.run_function('cmd.retcode', ['exit 0'], python_shell=True), 0)
|
||||||
self.assertEqual(self.run_function('cmd.retcode', ['exit 1'], python_shell=True), 1)
|
self.assertEqual(self.run_function('cmd.retcode', ['exit 1'], python_shell=True), 1)
|
||||||
|
|
||||||
|
def test_script(self):
|
||||||
|
'''
|
||||||
|
cmd.script
|
||||||
|
'''
|
||||||
|
args = 'saltines crackers biscuits=yes'
|
||||||
|
script = 'salt://script.py'
|
||||||
|
ret = self.run_function('cmd.script', [script, args])
|
||||||
|
self.assertEqual(ret['stdout'], args)
|
||||||
|
|
||||||
|
def test_script_retcode(self):
|
||||||
|
'''
|
||||||
|
cmd.script_retcode
|
||||||
|
'''
|
||||||
|
script = 'salt://script.py'
|
||||||
|
ret = self.run_function('cmd.script_retcode', [script])
|
||||||
|
self.assertEqual(ret, 0)
|
||||||
|
|
||||||
|
@destructiveTest
|
||||||
|
def test_tty(self):
|
||||||
|
'''
|
||||||
|
cmd.tty
|
||||||
|
'''
|
||||||
|
for tty in ('tty0', 'pts3'):
|
||||||
|
if os.path.exists(os.path.join('/dev', tty)):
|
||||||
|
ret = self.run_function('cmd.tty', [tty, 'apply salt liberally'])
|
||||||
|
self.assertTrue('Success' in ret)
|
||||||
|
|
||||||
@skip_if_binaries_missing(['which'])
|
@skip_if_binaries_missing(['which'])
|
||||||
def test_which(self):
|
def test_which(self):
|
||||||
'''
|
'''
|
||||||
@ -159,6 +191,15 @@ class CMDModuleTest(integration.ModuleCase):
|
|||||||
self.assertEqual(self.run_function('cmd.which', ['cat']).rstrip(),
|
self.assertEqual(self.run_function('cmd.which', ['cat']).rstrip(),
|
||||||
self.run_function('cmd.run', ['which cat']).rstrip())
|
self.run_function('cmd.run', ['which cat']).rstrip())
|
||||||
|
|
||||||
|
@skip_if_binaries_missing(['which'])
|
||||||
|
def test_which_bin(self):
|
||||||
|
'''
|
||||||
|
cmd.which_bin
|
||||||
|
'''
|
||||||
|
cmds = ['pip2', 'pip', 'pip-python']
|
||||||
|
ret = self.run_function('cmd.which_bin', [cmds])
|
||||||
|
self.assertTrue(os.path.split(ret)[1] in cmds)
|
||||||
|
|
||||||
def test_has_exec(self):
|
def test_has_exec(self):
|
||||||
'''
|
'''
|
||||||
cmd.has_exec
|
cmd.has_exec
|
||||||
@ -172,10 +213,9 @@ class CMDModuleTest(integration.ModuleCase):
|
|||||||
'''
|
'''
|
||||||
cmd.exec_code
|
cmd.exec_code
|
||||||
'''
|
'''
|
||||||
code = '''
|
code = textwrap.dedent('''\
|
||||||
import sys
|
import sys
|
||||||
sys.stdout.write('cheese')
|
sys.stdout.write('cheese')''')
|
||||||
'''
|
|
||||||
self.assertEqual(self.run_function('cmd.exec_code',
|
self.assertEqual(self.run_function('cmd.exec_code',
|
||||||
[AVAILABLE_PYTHON_EXECUTABLE,
|
[AVAILABLE_PYTHON_EXECUTABLE,
|
||||||
code]).rstrip(),
|
code]).rstrip(),
|
||||||
|
Loading…
Reference in New Issue
Block a user