mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Deprecate 'master_shuffle' in favor of 'random_master'
This commit is contained in:
parent
570f76d429
commit
ae201823c1
12
conf/minion
12
conf/minion
@ -26,14 +26,14 @@
|
||||
#no_proxy: []
|
||||
|
||||
# If multiple masters are specified in the 'master' setting, the default behavior
|
||||
# is to always try to connect to them in the order they are listed. If random_master is
|
||||
# set to True, the order will be randomized instead. This can be helpful in distributing
|
||||
# the load of many minions executing salt-call requests, for example, from a cron job.
|
||||
# If only one master is listed, this setting is ignored and a warning will be logged.
|
||||
# NOTE: If master_type is set to failover, use master_shuffle instead.
|
||||
# is to always try to connect to them in the order they are listed. If random_master
|
||||
# is set to True, the order will be randomized upon Minion startup instead. This can
|
||||
# be helpful in distributing the load of many minions executing salt-call requests,
|
||||
# for example, from a cron job. If only one master is listed, this setting is ignored
|
||||
# and a warning will be logged.
|
||||
#random_master: False
|
||||
|
||||
# Use if master_type is set to failover.
|
||||
# NOTE: Deprecated in Salt Fluorine. Use 'random_master' instead.
|
||||
#master_shuffle: False
|
||||
|
||||
# Minions can connect to multiple masters simultaneously (all masters
|
||||
|
@ -286,13 +286,14 @@ to the next master in the list if it finds the existing one is dead.
|
||||
------------------
|
||||
|
||||
.. versionadded:: 2014.7.0
|
||||
.. deprecated:: Fluorine
|
||||
|
||||
Default: ``False``
|
||||
|
||||
If :conf_minion:`master` is a list of addresses and :conf_minion`master_type`
|
||||
is ``failover``, shuffle them before trying to connect to distribute the
|
||||
minions over all available masters. This uses Python's :func:`random.shuffle
|
||||
<python2:random.shuffle>` method.
|
||||
.. warning::
|
||||
|
||||
This option has been deprecated in Salt ``Fluorine``. Please use
|
||||
:conf_minion:`random_master` instead.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
@ -303,17 +304,38 @@ minions over all available masters. This uses Python's :func:`random.shuffle
|
||||
``random_master``
|
||||
-----------------
|
||||
|
||||
.. versionadded:: 2014.7.0
|
||||
.. versionchanged:: Fluorine
|
||||
The :conf_minion:`master_failback` option can be used in conjunction with
|
||||
``random_master`` to force the minion to fail back to the first master in the
|
||||
list if the first master is back online. Note that :conf_minion:`master_type`
|
||||
must be set to ``failover`` in order for the ``master_failback`` setting to
|
||||
work.
|
||||
|
||||
Default: ``False``
|
||||
|
||||
If :conf_minion:`master` is a list of addresses, and :conf_minion`master_type`
|
||||
is set to ``failover`` shuffle them before trying to connect to distribute the
|
||||
minions over all available masters. This uses Python's :func:`random.shuffle
|
||||
<python2:random.shuffle>` method.
|
||||
If :conf_minion:`master` is a list of addresses, shuffle them before trying to
|
||||
connect to distribute the minions over all available masters. This uses Python's
|
||||
:func:`random.shuffle <python2:random.shuffle>` method.
|
||||
|
||||
If multiple masters are specified in the 'master' setting as a list, the default
|
||||
behavior is to always try to connect to them in the order they are listed. If
|
||||
``random_master`` is set to True, the order will be randomized instead upon Minion
|
||||
startup. This can be helpful in distributing the load of many minions executing
|
||||
``salt-call`` requests, for example, from a cron job. If only one master is listed,
|
||||
this setting is ignored and a warning is logged.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
random_master: True
|
||||
|
||||
.. note::
|
||||
|
||||
When the ``failover``, ``master_failback``, and ``random_master`` options are
|
||||
used together, only the "secondary masters" will be shuffled. The first master
|
||||
in the list is ignored in the :func:`random.shuffle <python2:random.shuffle>`
|
||||
call. See :conf_minion:`master_failback` for more information.
|
||||
|
||||
.. conf_minion:: retry_dns
|
||||
|
||||
``retry_dns``
|
||||
|
@ -477,6 +477,12 @@ their code to use ``tgt_type``.
|
||||
>>> local.cmd('*', 'cmd.run', ['whoami'], tgt_type='glob')
|
||||
{'jerry': 'root'}
|
||||
|
||||
Minion Configuration Deprecations
|
||||
---------------------------------
|
||||
|
||||
The :conf_minion:`master_shuffle` configuration option is deprecated as of the
|
||||
``Fluorine`` release. Please use the :conf_minion:`random_master` option instead.
|
||||
|
||||
Module Deprecations
|
||||
-------------------
|
||||
|
||||
|
@ -134,7 +134,8 @@ VALID_OPTS = {
|
||||
# a master fingerprint with `salt-key -F master`
|
||||
'master_finger': six.string_types,
|
||||
|
||||
# Selects a random master when starting a minion up in multi-master mode
|
||||
# Deprecated in Fluorine. Use 'random_master' instead.
|
||||
# Do not remove! Keep as an alias for usability.
|
||||
'master_shuffle': bool,
|
||||
|
||||
# When in multi-master mode, temporarily remove a master from the list if a conenction
|
||||
@ -967,6 +968,8 @@ VALID_OPTS = {
|
||||
# Never give up when trying to authenticate to a master
|
||||
'auth_safemode': bool,
|
||||
|
||||
# Selects a random master when starting a minion up in multi-master mode or
|
||||
# when starting a minion with salt-call. ``master`` must be a list.
|
||||
'random_master': bool,
|
||||
|
||||
# An upper bound for the amount of time for a minion to sleep before attempting to
|
||||
|
@ -507,12 +507,12 @@ class MinionBase(object):
|
||||
log.warning('master_type = distributed needs more than 1 master.')
|
||||
|
||||
if opts['master_shuffle']:
|
||||
if opts['master_failback']:
|
||||
secondary_masters = opts['master'][1:]
|
||||
shuffle(secondary_masters)
|
||||
opts['master'][1:] = secondary_masters
|
||||
else:
|
||||
shuffle(opts['master'])
|
||||
log.warning(
|
||||
'Use of \'master_shuffle\' detected. \'master_shuffle\' is deprecated in favor '
|
||||
'of \'random_master\'. Please update your minion config file.'
|
||||
)
|
||||
opts['random_master'] = opts['master_shuffle']
|
||||
|
||||
opts['auth_tries'] = 0
|
||||
if opts['master_failback'] and opts['master_failback_interval'] == 0:
|
||||
opts['master_failback_interval'] = opts['master_alive_interval']
|
||||
@ -578,12 +578,19 @@ class MinionBase(object):
|
||||
# happy with the first one that allows us to connect
|
||||
if isinstance(opts['master'], list):
|
||||
conn = False
|
||||
# shuffle the masters and then loop through them
|
||||
opts['local_masters'] = copy.copy(opts['master'])
|
||||
if opts['random_master']:
|
||||
shuffle(opts['local_masters'])
|
||||
last_exc = None
|
||||
opts['master_uri_list'] = list()
|
||||
opts['master_uri_list'] = []
|
||||
opts['local_masters'] = copy.copy(opts['master'])
|
||||
|
||||
# shuffle the masters and then loop through them
|
||||
if opts['random_master']:
|
||||
# master_failback is only used when master_type is set to failover
|
||||
if opts['master_type'] == 'failover' and opts['master_failback']:
|
||||
secondary_masters = opts['local_masters'][1:]
|
||||
shuffle(secondary_masters)
|
||||
opts['local_masters'][1:] = secondary_masters
|
||||
else:
|
||||
shuffle(opts['local_masters'])
|
||||
|
||||
# This sits outside of the connection loop below because it needs to set
|
||||
# up a list of master URIs regardless of which masters are available
|
||||
|
Loading…
Reference in New Issue
Block a user