Skip to content

Commit

Permalink
Merge pull request #37619 from rallytime/merge-develop
Browse files Browse the repository at this point in the history
[develop] Merge forward from 2016.11 to develop
  • Loading branch information
Nicole Thomas committed Nov 11, 2016
2 parents 40b2459 + b86e927 commit f7f7b98
Show file tree
Hide file tree
Showing 111 changed files with 1,279 additions and 461 deletions.
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def inner(fn, *iargs, **ikwargs):
latest_release = '2016.3.4' # latest release
previous_release = '2015.8.12' # latest release from previous branch
previous_release_dir = '2015.8' # path on web server for previous branch
next_release = '' # next release
next_release_dir = '' # path on web server for next release branch
next_release = '2016.11' # next release
next_release_dir = '2016.11' # path on web server for next release branch

today = ''
copyright = ''
Expand Down
4 changes: 2 additions & 2 deletions doc/man/salt.7
Original file line number Diff line number Diff line change
Expand Up @@ -44946,7 +44946,7 @@ set in the master\(aqs configuration file:
.sp
.nf
.ft C
requests_lib: True
backend: requests
.ft P
.fi
.UNINDENT
Expand Down Expand Up @@ -232680,7 +232680,7 @@ my\-rest\-api:
url: https://api.github.com/
keys:
url: https://api.github.com/users/{{user}}/keys
requests_lib: True
backend: requests
.ft P
.fi
.UNINDENT
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/configuration/master.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3096,7 +3096,7 @@ master, specify the log_file of the syndic daemon.
syndic_log_file: salt-syndic.log
.. master_conf:: syndic_failover
.. conf_master:: syndic_failover

``syndic_failover``
-------------------
Expand Down
4 changes: 2 additions & 2 deletions doc/ref/configuration/minion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ The port number used for HTTP proxy access.
.. conf_minion:: proxy_username

``proxy_username``
--------------
------------------

Default: ``''``

Expand All @@ -1005,7 +1005,7 @@ The username used for HTTP proxy access.
.. conf_minion:: proxy_password

``proxy_password``
--------------
------------------

Default: ``''``

Expand Down
4 changes: 2 additions & 2 deletions doc/topics/cloud/azure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The name of the service in which to create the VM. If this is not specified,
then a service will be created with the same name as the VM.

virtual_network_name
------------
--------------------
Optional. The name of the virtual network for the VM to join. If this is not
specified, then no virtual network will be joined.

Expand Down Expand Up @@ -710,7 +710,7 @@ set in the master's configuration file:

.. code-block:: bash
requests_lib: True
backend: requests
The following functions are available.

Expand Down
4 changes: 2 additions & 2 deletions doc/topics/event/master_events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Key events
.. salt:event:: salt/key
Fired when accepting and rejecting minions keys on the Salt master.
These happen as a result of actions undertaken by the `salt-key` command.

:var id: The minion ID.
:var act: The new status of the minion key: ``accept``, ``pend``,
``reject``, ``delete``.
:var act: The new status of the minion key: ``accept``, ``delete``,

.. warning:: If a master is in :conf_master:`auto_accept mode`, ``salt/key`` events
will not be fired when the keys are accepted. In addition, pre-seeding
Expand Down
8 changes: 8 additions & 0 deletions doc/topics/installation/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ least one item must be selected.
You will also be prompted on the final page to start the ``salt-master``
service.

Installation Prerequisites
--------------------------

Most Salt functionality should work just fine right out of the box. A few Salt
modules rely on PowerShell. The minimum version of PowerShell required for Salt
is version 3. If you intend to work with DSC then Powershell version 5 is the
minimum.

.. _windows-installer-options:

Silent Installer Options
Expand Down
22 changes: 22 additions & 0 deletions doc/topics/releases/2016.3.5.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
===========================
Salt 2016.3.5 Release Notes
===========================

Version 2016.3.5 is a bugfix release for :doc:`2016.3.0
</topics/releases/2016.3.0>`.


Improved Checksum Handling in :py:func:`file.managed <salt.states.file.managed>`, :py:func:`archive.extracted <salt.states.archive.extracted>` States
-----------------------------------------------------------------------------------------------------------------------------------------------------

When the ``source_hash`` argument for these states refers to a file containing
checksums, Salt now looks for checksums matching the name of the source URI, as
well as the file being managed. Prior releases only looked for checksums
matching the filename being managed. Additionally, a new argument
(``source_hash_name``) has been added, which allows the user to disambiguate
ambiguous matches when more than one matching checksum is found in the
``source_hash`` file.

A more detailed explanation of this functionality can be found in the
:py:func:`file.managed <salt.states.file.managed>` documentation, in the
section for the new ``source_hash_name`` argument.
4 changes: 2 additions & 2 deletions doc/topics/releases/releasecandidate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Builds for a few platforms are available as part of the RC at https://repo.salts
baseurl=https://repo.saltstack.com/salt_rc/yum/redhat/$releasever/$basearch/
.. code-block::
.. code-block:: none
deb http://repo.saltstack.com/salt_rc/apt/ubuntu/14.04/amd64 jessie main
Expand Down Expand Up @@ -126,4 +126,4 @@ Then install salt using the following command:

.. code-block:: bash
sudo pip install salt==v2016.11.0rc2
sudo pip install salt==2016.11.0rc2
2 changes: 1 addition & 1 deletion doc/topics/tutorials/http.rst
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ using the ``ca_bundle`` variable.
)
Updating CA Bundles
+++++++++++++++++++
'''''''''''''''''''
The ``update_ca_bundle()`` function can be used to update the bundle file at a
specified location. If the target location is not specified, then it will
attempt to auto-detect the location of the bundle file. If the URL to download
Expand Down
3 changes: 3 additions & 0 deletions pkg/osx/pkg-scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ ln -sf /opt/salt/bin/salt-config.sh /usr/local/sbin/salt-config
# Add salt to paths.d
###############################################################################
# echo "Path: Adding salt to the path..." >> /tmp/postinstall.txt
if [ ! -d "/etc/paths.d" ]; then
mkdir /etc/paths.d
fi
sh -c 'echo "/opt/salt/bin" > /etc/paths.d/salt'
sh -c 'echo "/usr/local/sbin" >> /etc/paths.d/salt'

Expand Down
1 change: 1 addition & 0 deletions pkg/rpm/salt-api
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ case "$1" in
echo -n "Checking for service salt-api "
checkproc $SALTAPI
rc_status -v
RETVAL=$?
elif [ -f $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
RETVAL=0
Expand Down
1 change: 1 addition & 0 deletions pkg/suse/salt-master
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ case "$1" in
echo -n "Checking for service salt-master "
checkproc $SALTMASTER
rc_status -v
RETVAL=$?
elif [ -f $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
RETVAL=0
Expand Down
2 changes: 2 additions & 0 deletions pkg/suse/salt-minion
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ start() {
if [ -f $SUSE_RELEASE ]; then
startproc -p /var/run/$SERVICE.pid $SALTMINION -d $MINION_ARGS
rc_status -v
RETVAL=$?
elif [ -e $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
echo -n "already started, lock file found"
Expand Down Expand Up @@ -114,6 +115,7 @@ case "$1" in
echo -n "Checking for service salt-minion "
checkproc $SALTMINION
rc_status -v
RETVAL=$?
elif [ -f $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
RETVAL=0
Expand Down
1 change: 1 addition & 0 deletions pkg/suse/salt-syndic
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ case "$1" in
echo -n "Checking for service salt-syndic "
checkproc $SALTSYNDIC
rc_status -v
RETVAL=$?
elif [ -f $DEBIAN_VERSION ]; then
if [ -f $LOCKFILE ]; then
RETVAL=0
Expand Down
2 changes: 1 addition & 1 deletion salt/beacons/inotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def beacon(config):
if re.search(exclude.keys()[0], event.pathname):
_append = False
except Exception:
log.warn('Failed to compile regex: {0}'.format(exclude.keys()[0]))
log.warning('Failed to compile regex: {0}'.format(exclude.keys()[0]))
else:
exclude = exclude.keys()[0]
elif '*' in exclude:
Expand Down
2 changes: 1 addition & 1 deletion salt/cache/localfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def updated(bank, key):
'''
key_file = os.path.join(__opts__['cachedir'], os.path.normpath(bank), '{0}.p'.format(key))
if not os.path.isfile(key_file):
log.warn('Cache file "%s" does not exist', key_file)
log.warning('Cache file "%s" does not exist', key_file)
return None
try:
return int(os.path.getmtime(key_file))
Expand Down
3 changes: 2 additions & 1 deletion salt/cli/salt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def run(self):

self.local_client = salt.client.get_local_client(
self.get_config_file_path(),
skip_perm_errors=skip_perm_errors)
skip_perm_errors=skip_perm_errors,
auto_reconnect=True)
except SaltClientError as exc:
self.exit(2, '{0}\n'.format(exc))
return
Expand Down
57 changes: 48 additions & 9 deletions salt/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def get_local_client(
c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
mopts=None,
skip_perm_errors=False,
io_loop=None):
io_loop=None,
auto_reconnect=False):
'''
.. versionadded:: 2014.7.0
Expand All @@ -99,7 +100,8 @@ def get_local_client(
return LocalClient(
mopts=opts,
skip_perm_errors=skip_perm_errors,
io_loop=io_loop)
io_loop=io_loop,
auto_reconnect=auto_reconnect)


class LocalClient(object):
Expand Down Expand Up @@ -134,7 +136,7 @@ class LocalClient(object):
def __init__(self,
c_path=os.path.join(syspaths.CONFIG_DIR, 'master'),
mopts=None, skip_perm_errors=False,
io_loop=None, keep_loop=False):
io_loop=None, keep_loop=False, auto_reconnect=False):
'''
:param IOLoop io_loop: io_loop used for events.
Pass in an io_loop if you want asynchronous
Expand All @@ -157,14 +159,16 @@ def __init__(self,
self.salt_user = salt.utils.get_specific_user()
self.skip_perm_errors = skip_perm_errors
self.key = self.__read_master_key()
self.auto_reconnect = auto_reconnect
self.event = salt.utils.event.get_event(
'master',
self.opts['sock_dir'],
self.opts['transport'],
opts=self.opts,
listen=False,
io_loop=io_loop,
keep_loop=keep_loop)
keep_loop=keep_loop,
raise_errors=auto_reconnect)
self.utils = salt.loader.utils(self.opts)
self.functions = salt.loader.minion_mods(self.opts, utils=self.utils)
self.returners = salt.loader.returners(self.opts, self.functions)
Expand Down Expand Up @@ -903,8 +907,16 @@ def get_returns_no_block(
'''

while True:
raw = self.event.get_event(wait=0.01, tag=tag, match_type=match_type, full=True, no_block=True)
yield raw
try:
raw = self.event.get_event(wait=0.01, tag=tag, match_type=match_type, full=True, no_block=True)
yield raw
except tornado.iostream.StreamClosedError:
if self.auto_reconnect:
log.warning('Connection to master lost. Reconnecting.')
self.event.close_pub()
self.event.connect_pub(timeout=self._get_timeout(None))
else:
raise

def get_iter_returns(
self,
Expand Down Expand Up @@ -1136,7 +1148,16 @@ def get_returns(
while True:
time_left = timeout_at - int(time.time())
wait = max(1, time_left)
raw = self.event.get_event(wait, jid)
try:
raw = self.event.get_event(wait, jid)
except tornado.iostream.StreamClosedError:
if self.auto_reconnect:
log.warning('Connection to master lost. Reconnecting.')
self.event.close_pub()
self.event.connect_pub(timeout=self._get_timeout(wait))
continue
else:
raise
if raw is not None and 'return' in raw:
found.add(raw['id'])
ret[raw['id']] = raw['return']
Expand Down Expand Up @@ -1289,7 +1310,16 @@ def get_cli_static_event_returns(
# Wait 0 == forever, use a minimum of 1s
wait = max(1, time_left)
jid_tag = 'salt/job/{0}'.format(jid)
raw = self.event.get_event(wait, jid_tag)
try:
raw = self.event.get_event(wait, jid_tag)
except tornado.iostream.StreamClosedError:
if self.auto_reconnect:
log.warning('Connection to master lost. Reconnecting.')
self.event.close_pub()
self.event.connect_pub(timeout=self._get_timeout(wait))
continue
else:
raise
if raw is not None and 'return' in raw:
if 'minions' in raw.get('data', {}):
minions.update(raw['data']['minions'])
Expand Down Expand Up @@ -1407,7 +1437,16 @@ def get_event_iter_returns(self, jid, minions, timeout=None):
raise StopIteration()
# Wait for the hosts to check in
while True:
raw = self.event.get_event(timeout)
try:
raw = self.event.get_event(timeout)
except tornado.iostream.StreamClosedError:
if self.auto_reconnect:
log.warning('Connection to master lost. Reconnecting.')
self.event.close_pub()
self.event.connect_pub(timeout=self._get_timeout(timeout))
continue
else:
raise
if raw is None or time.time() > timeout_at:
# Timeout reached
break
Expand Down
8 changes: 4 additions & 4 deletions salt/cloud/clouds/azurearm.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _cache(bank, key, fun, **kwargs):
try:
item_list = fun(**kwargs)
except CloudError as exc:
log.warn('There was a cloud error calling {0} with kwargs {1}: {2}'.format(fun, kwargs, exc))
log.warning('There was a cloud error calling {0} with kwargs {1}: {2}'.format(fun, kwargs, exc))
for item in item_list:
items[item.name] = object_to_dict(item)
cache.store(bank, key, items)
Expand Down Expand Up @@ -1024,8 +1024,8 @@ def request_instance(call=None, kwargs=None): # pylint: disable=unused-argument
try:
poller.wait()
except CloudError as exc:
log.warn('There was a cloud error: {0}'.format(exc))
log.warn('This may or may not indicate an actual problem')
log.warning('There was a cloud error: {0}'.format(exc))
log.warning('This may or may not indicate an actual problem')

try:
return show_instance(vm_['name'], call='action')
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def _query_ip_address():
)
except (SaltCloudExecutionTimeout, SaltCloudExecutionFailure, SaltCloudSystemExit) as exc:
try:
log.warn(exc)
log.warning(exc)
finally:
raise SaltCloudSystemExit(str(exc))

Expand Down

0 comments on commit f7f7b98

Please sign in to comment.