Merge branch '2016.3' into ollie_blacklist

This commit is contained in:
Nicole Thomas 2017-03-16 11:01:10 -06:00 committed by GitHub
commit 0ac2e83d37
12 changed files with 1191 additions and 31 deletions

View file

@ -1,7 +1,5 @@
{
"skipTitle": "Merge forward",
"delayed": true,
"delayedUntil": "2h",
"userBlacklist": ["olliewalsh"]
}

File diff suppressed because it is too large Load diff

View file

@ -220,7 +220,7 @@ class LocalClient(object):
Return the information about a given job
'''
log.debug('Checking whether jid {0} is still running'.format(jid))
timeout = self.opts['gather_job_timeout']
timeout = kwargs.get('gather_job_timeout', self.opts['gather_job_timeout'])
pub_data = self.run_job(tgt,
'saltutil.find_job',
@ -921,6 +921,7 @@ class LocalClient(object):
if timeout is None:
timeout = self.opts['timeout']
gather_job_timeout = kwargs.get('gather_job_timeout', self.opts['gather_job_timeout'])
start = int(time.time())
# timeouts per minion, id_ -> timeout time
@ -1019,7 +1020,7 @@ class LocalClient(object):
jinfo_iter = []
else:
jinfo_iter = self.get_returns_no_block('salt/job/{0}'.format(jinfo['jid']))
timeout_at = time.time() + self.opts['gather_job_timeout']
timeout_at = time.time() + gather_job_timeout
# if you are a syndic, wait a little longer
if self.opts['order_masters']:
timeout_at += self.opts.get('syndic_wait', 1)

View file

@ -702,10 +702,10 @@ def run(cmd,
:param str stdin: A string of standard input can be specified for the
command to be run using the ``stdin`` parameter. This can be useful in cases
where sensitive information must be read from standard input.:
where sensitive information must be read from standard input.
:param str runas: User to run script as. If running on a Windows minion you
must also pass a password
must also pass a password.
:param str password: Windows only. Required when specifying ``runas``. This
parameter will be ignored on non-Windows platforms.
@ -715,10 +715,14 @@ def run(cmd,
:param str shell: Shell to execute under. Defaults to the system default
shell.
:param bool python_shell: If False, let python handle the positional
arguments. Set to True to use shell features, such as pipes or redirection
:param bool python_shell: If ``False``, let python handle the positional
arguments. Set to ``True`` to use shell features, such as pipes or
redirection.
:param bool bg: If True, run command in background and do not await or deliver it's results
:param bool bg: If ``True``, run command in background and do not await or
deliver it's results
.. versionadded:: 2016.3.0
:param list env: A list of environment variables to be set prior to
execution.
@ -1543,14 +1547,23 @@ def run_all(cmd,
``env`` represents the environment variables for the command, and
should be formatted as a dict, or a YAML string which resolves to a dict.
redirect_stderr : False
If set to ``True``, then stderr will be redirected to stdout. This is
helpful for cases where obtaining both the retcode and output is
desired, but it is not desired to have the output separated into both
stdout and stderr.
:param bool redirect_stderr: If set to ``True``, then stderr will be
redirected to stdout. This is helpful for cases where obtaining both the
retcode and output is desired, but it is not desired to have the output
separated into both stdout and stderr.
.. versionadded:: 2015.8.2
:param str password: Windows only. Required when specifying ``runas``. This
parameter will be ignored on non-Windows platforms.
.. versionadded:: 2016.3.0
:param bool bg: If ``True``, run command in background and do not await or
deliver it's results
.. versionadded:: 2016.3.6
CLI Example:
.. code-block:: bash
@ -1594,10 +1607,10 @@ def run_all(cmd,
reset_system_locale=reset_system_locale,
ignore_retcode=ignore_retcode,
saltenv=saltenv,
pillarenv=kwargs.get('pillarenv'),
pillar_override=kwargs.get('pillar'),
use_vt=use_vt,
password=password)
password=password,
**kwargs)
log_callback = _check_cb(log_callback)

View file

@ -775,7 +775,10 @@ def _get_client(timeout=None):
- docker.url: URL to the docker service
- docker.version: API version to use (default: "auto")
'''
if 'docker.client' not in __context__:
# In some edge cases, the client instance is missing attributes. Don't use
# the cached client in those cases.
if 'docker.client' not in __context__ \
or not hasattr(__context__['docker.client'], 'timeout'):
client_kwargs = {}
for key, val in (('base_url', 'docker.url'),
('version', 'docker.version')):

View file

@ -1082,6 +1082,9 @@ def list_(prefix=None,
elif line.startswith('-e'):
line = line.split('-e ')[1]
version_, name = line.split('#egg=')
elif len(line.split('===')) >= 2:
name = line.split('===')[0]
version_ = line.split('===')[1]
elif len(line.split('==')) >= 2:
name = line.split('==')[0]
version_ = line.split('==')[1]

View file

@ -972,7 +972,7 @@ def build_interface(iface, iface_type, enabled, **settings):
if iface_type == 'bridge':
__salt__['pkg.install']('bridge-utils')
if iface_type in ['eth', 'bond', 'bridge', 'slave', 'vlan', 'ipip', 'ib']:
if iface_type in ['eth', 'bond', 'bridge', 'slave', 'vlan', 'ipip', 'ib', 'alias']:
opts = _parse_settings_eth(settings, iface_type, enabled, iface)
try:
template = JINJA.get_template('rh{0}_eth.jinja'.format(rh_major))

View file

@ -30,7 +30,7 @@ from salt.exceptions import SaltClientError
FINGERPRINT_REGEX = re.compile(r'^([a-f0-9]{2}:){15}([a-f0-9]{2})$')
def status(output=True):
def status(output=True, timeout=None, gather_job_timeout=None):
'''
Print the status of all known salt minions
@ -42,8 +42,14 @@ def status(output=True):
'''
ret = {}
client = salt.client.get_local_client(__opts__['conf_file'])
if not timeout:
timeout = __opts__['timeout']
if not gather_job_timeout:
gather_job_timeout = __opts__['gather_job_timeout']
try:
minions = client.cmd('*', 'test.ping', timeout=__opts__['timeout'])
minions = client.cmd('*', 'test.ping', timeout=timeout, gather_job_timeout=gather_job_timeout)
except SaltClientError as client_error:
print(client_error)
return ret
@ -128,7 +134,7 @@ def down(removekeys=False):
return ret
def up(): # pylint: disable=C0103
def up(timeout=None, gather_job_timeout=None): # pylint: disable=C0103
'''
Print a list of all of the minions that are up
@ -137,8 +143,13 @@ def up(): # pylint: disable=C0103
.. code-block:: bash
salt-run manage.up
salt-run manage.up timeout=5 gather_job_timeout=5
'''
ret = status(output=False).get('up', [])
ret = status(
output=False,
timeout=timeout,
gather_job_timeout=gather_job_timeout
).get('up', [])
return ret

View file

@ -750,6 +750,12 @@ def run(name,
interactively to the console and the logs.
This is experimental.
bg
If ``True``, run command in background and do not await or deliver it's
results.
.. versionadded:: 2016.3.6
.. note::
cmd.run supports the usage of ``reload_modules``. This functionality
@ -770,10 +776,10 @@ def run(name,
- reload_modules: True
'''
### NOTE: The keyword arguments in **kwargs are ignored in this state, but
### cannot be removed from the function definition, otherwise the use
### of unsupported arguments in a cmd.run state will result in a
### traceback.
### NOTE: The keyword arguments in **kwargs are passed directly to the
### ``cmd.run_all`` function and cannot be removed from the function
### definition, otherwise the use of unsupported arguments in a
### ``cmd.run`` state will result in a traceback.
test_name = None
if not isinstance(stateful, list):

View file

@ -1490,6 +1490,8 @@ def running(name,
the format ``<ulimit_name>:<soft_limit>:<hard_limit>``, with the hard
limit being optional.
.. versionadded:: 2016.3.6,2016.11.4,Nitrogen
.. code-block:: yaml
foo:
@ -2383,7 +2385,7 @@ def volume_absent(name, driver=None):
'''
Ensure that a volume is absent.
.. versionadded:: 2015.8.4
.. versionadded:: 2015.8.4,
name
Name of the volume

View file

@ -672,8 +672,8 @@ def default_signals(*signals):
old_signals = {}
for signum in signals:
try:
signal.signal(signum, signal.SIG_DFL)
old_signals[signum] = signal.getsignal(signum)
signal.signal(signum, signal.SIG_DFL)
except ValueError as exc:
# This happens when a netapi module attempts to run a function
# using wheel_async, because the process trying to register signals

View file

@ -142,9 +142,8 @@ class GrainsAppendTestCase(integration.ModuleCase):
GRAIN_VAL = 'my-grain-val'
def tearDown(self):
test_grain = self.run_function('grains.get', [self.GRAIN_KEY])
if test_grain and test_grain == [self.GRAIN_VAL]:
self.run_function('grains.remove', [self.GRAIN_KEY, self.GRAIN_VAL])
for item in self.run_function('grains.get', [self.GRAIN_KEY]):
self.run_function('grains.remove', [self.GRAIN_KEY, item])
def test_grains_append(self):
'''