mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +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: []
|
#no_proxy: []
|
||||||
|
|
||||||
# If multiple masters are specified in the 'master' setting, the default behavior
|
# 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
|
# is to always try to connect to them in the order they are listed. If random_master
|
||||||
# set to True, the order will be randomized instead. This can be helpful in distributing
|
# is set to True, the order will be randomized upon Minion startup instead. This can
|
||||||
# the load of many minions executing salt-call requests, for example, from a cron job.
|
# be helpful in distributing the load of many minions executing salt-call requests,
|
||||||
# If only one master is listed, this setting is ignored and a warning will be logged.
|
# for example, from a cron job. If only one master is listed, this setting is ignored
|
||||||
# NOTE: If master_type is set to failover, use master_shuffle instead.
|
# and a warning will be logged.
|
||||||
#random_master: False
|
#random_master: False
|
||||||
|
|
||||||
# Use if master_type is set to failover.
|
# NOTE: Deprecated in Salt Fluorine. Use 'random_master' instead.
|
||||||
#master_shuffle: False
|
#master_shuffle: False
|
||||||
|
|
||||||
# Minions can connect to multiple masters simultaneously (all masters
|
# 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
|
.. versionadded:: 2014.7.0
|
||||||
|
.. deprecated:: Fluorine
|
||||||
|
|
||||||
Default: ``False``
|
Default: ``False``
|
||||||
|
|
||||||
If :conf_minion:`master` is a list of addresses and :conf_minion`master_type`
|
.. warning::
|
||||||
is ``failover``, shuffle them before trying to connect to distribute the
|
|
||||||
minions over all available masters. This uses Python's :func:`random.shuffle
|
This option has been deprecated in Salt ``Fluorine``. Please use
|
||||||
<python2:random.shuffle>` method.
|
:conf_minion:`random_master` instead.
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
@ -303,17 +304,38 @@ minions over all available masters. This uses Python's :func:`random.shuffle
|
|||||||
``random_master``
|
``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``
|
Default: ``False``
|
||||||
|
|
||||||
If :conf_minion:`master` is a list of addresses, and :conf_minion`master_type`
|
If :conf_minion:`master` is a list of addresses, shuffle them before trying to
|
||||||
is set to ``failover`` shuffle them before trying to connect to distribute the
|
connect to distribute the minions over all available masters. This uses Python's
|
||||||
minions over all available masters. This uses Python's :func:`random.shuffle
|
:func:`random.shuffle <python2:random.shuffle>` method.
|
||||||
<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
|
.. code-block:: yaml
|
||||||
|
|
||||||
random_master: True
|
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
|
.. conf_minion:: retry_dns
|
||||||
|
|
||||||
``retry_dns``
|
``retry_dns``
|
||||||
|
@ -477,6 +477,12 @@ their code to use ``tgt_type``.
|
|||||||
>>> local.cmd('*', 'cmd.run', ['whoami'], tgt_type='glob')
|
>>> local.cmd('*', 'cmd.run', ['whoami'], tgt_type='glob')
|
||||||
{'jerry': 'root'}
|
{'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
|
Module Deprecations
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -134,7 +134,8 @@ VALID_OPTS = {
|
|||||||
# a master fingerprint with `salt-key -F master`
|
# a master fingerprint with `salt-key -F master`
|
||||||
'master_finger': six.string_types,
|
'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,
|
'master_shuffle': bool,
|
||||||
|
|
||||||
# When in multi-master mode, temporarily remove a master from the list if a conenction
|
# 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
|
# Never give up when trying to authenticate to a master
|
||||||
'auth_safemode': bool,
|
'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,
|
'random_master': bool,
|
||||||
|
|
||||||
# An upper bound for the amount of time for a minion to sleep before attempting to
|
# 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.')
|
log.warning('master_type = distributed needs more than 1 master.')
|
||||||
|
|
||||||
if opts['master_shuffle']:
|
if opts['master_shuffle']:
|
||||||
if opts['master_failback']:
|
log.warning(
|
||||||
secondary_masters = opts['master'][1:]
|
'Use of \'master_shuffle\' detected. \'master_shuffle\' is deprecated in favor '
|
||||||
shuffle(secondary_masters)
|
'of \'random_master\'. Please update your minion config file.'
|
||||||
opts['master'][1:] = secondary_masters
|
)
|
||||||
else:
|
opts['random_master'] = opts['master_shuffle']
|
||||||
shuffle(opts['master'])
|
|
||||||
opts['auth_tries'] = 0
|
opts['auth_tries'] = 0
|
||||||
if opts['master_failback'] and opts['master_failback_interval'] == 0:
|
if opts['master_failback'] and opts['master_failback_interval'] == 0:
|
||||||
opts['master_failback_interval'] = opts['master_alive_interval']
|
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
|
# happy with the first one that allows us to connect
|
||||||
if isinstance(opts['master'], list):
|
if isinstance(opts['master'], list):
|
||||||
conn = False
|
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
|
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
|
# 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
|
# up a list of master URIs regardless of which masters are available
|
||||||
|
Loading…
Reference in New Issue
Block a user