Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2015.5' into merge-forward-2015.8
Browse files Browse the repository at this point in the history
Conflicts:
    salt/config.py
    salt/minion.py
    salt/pillar/s3.py
  • Loading branch information
basepi committed Nov 9, 2015
2 parents cfa0cec + 604a7b4 commit aeeaa7c
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 92 deletions.
4 changes: 3 additions & 1 deletion conf/minion
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
# master_type: str

# Poll interval in seconds for checking if the master is still there. Only
# respected if master_type above is "failover".
# respected if master_type above is "failover". To disable the interval entirely,
# set the value to -1. (This may be necessary on machines which have high numbers
# of TCP connections, such as load balancers.)
# master_alive_interval: 30

# Set whether the minion should connect to the master via IPv6:
Expand Down
29 changes: 29 additions & 0 deletions doc/ref/configuration/minion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,35 @@ behavior is to have time-frame within all minions try to reconnect.
recon_randomize: True
.. conf_minion:: return_retry_timer

``return_retry_timer``
-------------------

Default: ``5``

The default timeout for a minion return attempt.

.. code-block:: yaml
return_retry_timer: 5
.. conf_minion:: return_retry_timer_max

``return_retry_timer_max``
-------------------

Default: ``10``

The maximum timeout for a minion return attempt. If non-zero the minion return
retry timeout will be a random int beween ``return_retry_timer`` and
``return_retry_timer_max``

.. code-block:: yaml
return_retry_timer_max: 10
.. conf_minion:: cache_sreqs

``cache_sreqs``
Expand Down
6 changes: 3 additions & 3 deletions salt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
'recon_randomize': float, # FIXME This should really be a bool, according to the implementation

'return_retry_timer': int,
'return_retry_random': bool,
'return_retry_timer_max': int,

# Specify a returner in which all events will be sent to. Requires that the returner in question
# have an event_return(event) function!
Expand Down Expand Up @@ -895,8 +895,8 @@
'recon_max': 10000,
'recon_default': 1000,
'recon_randomize': True,
'return_retry_timer': 4,
'return_retry_random': True,
'return_retry_timer': 5,
'return_retry_timer_max': 10,
'syndic_log_file': os.path.join(salt.syspaths.LOGS_DIR, 'syndic'),
'syndic_pidfile': os.path.join(salt.syspaths.PIDFILE_DIR, 'salt-syndic.pid'),
'random_reauth_delay': 10,
Expand Down
16 changes: 9 additions & 7 deletions salt/minion.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,20 +799,22 @@ def _return_retry_timer(self):
just return the value of the return_retry_timer.
'''
msg = 'Minion return retry timer set to {0} seconds'
if self.opts.get('return_retry_random'):
if self.opts.get('return_retry_timer_max'):
try:
random_retry = randint(1, self.opts['return_retry_timer'])
random_retry = randint(self.opts['return_retry_timer'], self.opts['return_retry_timer_max'])
log.debug(msg.format(random_retry) + ' (randomized)')
return random_retry
except ValueError:
# Catch wiseguys using negative integers here
log.error(
'Invalid value ({0}) for return_retry_timer, must be a '
'positive integer'.format(self.opts['return_retry_timer'])
'Invalid value (return_retry_timer: {0} or return_retry_timer_max: {1})'
'both must be a positive integers'.format(
self.opts['return_retry_timer'],
self.opts['return_retry_timer_max'],
)
)
log.debug(msg.format(DEFAULT_MINION_OPTS['return_retry_timer']))
return DEFAULT_MINION_OPTS['return_retry_timer']
else:
log.debug(msg.format(random_retry) + ' (randomized)')
return random_retry
else:
log.debug(msg.format(self.opts.get('return_retry_timer')))
return self.opts.get('return_retry_timer')
Expand Down
2 changes: 2 additions & 0 deletions salt/modules/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,7 @@ def replace(path,
if filesize is not 0:
# First check the whole file, determine whether to make the replacement
# Searching first avoids modifying the time stamp if there are no changes
r_data = None
try:
# Use a read-only handle to open the file
with salt.utils.fopen(path,
Expand Down Expand Up @@ -1858,6 +1859,7 @@ def replace(path,
except (OSError, IOError) as exc:
raise CommandExecutionError("Exception: {0}".format(exc))

r_data = None
try:
# Open the file in write mode
with salt.utils.fopen(path,
Expand Down
2 changes: 1 addition & 1 deletion salt/modules/ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _get_proc_username(proc):
'''
try:
return proc.username() if PSUTIL2 else proc.username
except (psutil.NoSuchProcess, psutil.AccessDenied):
except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError):
return None


Expand Down
8 changes: 3 additions & 5 deletions salt/modules/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ def list_vhosts(runas=None):
'''
if runas is None:
runas = salt.utils.get_user()
res = __salt__['cmd.run']('rabbitmqctl list_vhosts',
runas=runas)

# remove first and last line: Listing ... - ...done
return _strip_listing_to_done(res.splitlines())
res = __salt__['cmd.run']('rabbitmqctl list_vhosts -q',
runas=runas).splitlines()
return res


def user_exists(name, runas=None):
Expand Down
Loading

0 comments on commit aeeaa7c

Please sign in to comment.