From 48b213e4f7e4e196139936527af0dabdb0896b63 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Sat, 27 Jul 2013 19:53:15 -0500 Subject: [PATCH] Fix warning during minion auth due to invalid config param type --- conf/minion | 8 ++++---- salt/config.py | 2 +- salt/minion.py | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/conf/minion b/conf/minion index 63b399c376ff..8762fa79cdf9 100644 --- a/conf/minion +++ b/conf/minion @@ -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 diff --git a/salt/config.py b/salt/config.py index abda0bcdbc7f..60e565c7040e 100644 --- a/salt/config.py +++ b/salt/config.py @@ -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, diff --git a/salt/minion.py b/salt/minion.py index ca58b58063fc..55395b1c44ed 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -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) @@ -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) @@ -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) @@ -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']