Skip to content

Commit

Permalink
Fix warning during minion auth due to invalid config param type
Browse files Browse the repository at this point in the history
  • Loading branch information
terminalmage authored and basepi committed Jul 29, 2013
1 parent e54e051 commit 48b213e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions conf/minion
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@
# seconds, between those reconnection attempts.
#acceptance_wait_time: 10

# If this is set, the time between reconnection attempts will increase by
# acceptance_wait_time seconds per iteration, up to this maximum. If this
# is not set, the time between reconnection attempts will stay constant.
# acceptance_wait_time_max: None
# If this is nonzero, the time between reconnection attempts will increase by
# acceptance_wait_time seconds per iteration, up to this maximum. If this is
# set to zero, the time between reconnection attempts will stay constant.
#acceptance_wait_time_max: 0

# When the master-key changes, the minion will try to re-auth itself to
# receive the new master key. In larger environments this can cause a
Expand Down
2 changes: 1 addition & 1 deletion salt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
'state_verbose': True,
'state_output': 'full',
'acceptance_wait_time': 10,
'acceptance_wait_time_max': None,
'acceptance_wait_time_max': 0,
'loop_interval': 1,
'dns_check': True,
'verify_env': True,
Expand Down
16 changes: 8 additions & 8 deletions salt/minion.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def _handle_aes(self, load):
# decryption of the payload failed, try to re-auth but wait
# random seconds if set in config with random_reauth_delay
if 'random_reauth_delay' in self.opts:
reauth_delay = randint(0, int(self.opts['random_reauth_delay']) )
reauth_delay = randint(0, int(self.opts['random_reauth_delay']))
log.debug("Waiting {0} seconds to re-authenticate".format(reauth_delay))
time.sleep(reauth_delay)

Expand Down Expand Up @@ -837,7 +837,7 @@ def authenticate(self, timeout=60, safe=True):
auth = salt.crypt.Auth(self.opts)
acceptance_wait_time = self.opts['acceptance_wait_time']
acceptance_wait_time_max = self.opts['acceptance_wait_time_max']
if acceptance_wait_time_max is None:
if not acceptance_wait_time_max:
acceptance_wait_time_max = acceptance_wait_time
while True:
creds = auth.sign_in(timeout, safe)
Expand All @@ -848,7 +848,7 @@ def authenticate(self, timeout=60, safe=True):
time.sleep(acceptance_wait_time)
if acceptance_wait_time < acceptance_wait_time_max:
acceptance_wait_time += acceptance_wait_time
log.debug('Authentication wait time is {0}'.format( acceptance_wait_time ))
log.debug('Authentication wait time is {0}'.format(acceptance_wait_time))
self.aes = creds['aes']
self.publish_port = creds['publish_port']
self.crypticle = salt.crypt.Crypticle(self.opts, self.aes)
Expand Down Expand Up @@ -967,23 +967,23 @@ def tune_in(self):
recon_delay = self.opts['recon_default']

if self.opts['recon_randomize']:
recon_delay = randint(self.opts['recon_default'],
recon_delay = randint(self.opts['recon_default'],
self.opts['recon_default'] + self.opts['recon_max']
)
)

log.debug("Generated random reconnect delay between '{0}ms' and '{1}ms' ({2})".format(
self.opts['recon_default'],
self.opts['recon_default'] + self.opts['recon_max'],
recon_delay)
)
)

log.debug("Setting zmq_reconnect_ivl to '{0}ms'".format(recon_delay))
self.socket.setsockopt(zmq.RECONNECT_IVL, recon_delay)

if hasattr(zmq, 'RECONNECT_IVL_MAX'):
log.debug("Setting zmq_reconnect_ivl_max to '{0}ms'".format(
log.debug("Setting zmq_reconnect_ivl_max to '{0}ms'".format(
self.opts['recon_default'] + self.opts['recon_max'])
)
)

self.socket.setsockopt(
zmq.RECONNECT_IVL_MAX, self.opts['recon_max']
Expand Down

0 comments on commit 48b213e

Please sign in to comment.