Created
November 2, 2020 14:16
-
-
Save bochi/019a54c7aa3782e2447c1347490e81b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(retry_int['attempts']): | |
# in case no otp is given by the state, get it from pillar | |
# this should happen within the loop, in case otp changes | |
if not otp: | |
try: | |
log.debug('Trying to get otp from pillar %s...' % pillar_key) | |
otp = __salt__['pillar.get'](pillar_key)[-1] | |
# if getting the otp from pillar fails, ask the master to generate a new one | |
except IndexError: | |
log.debug('Unable to get otp from pillar, otp is %s' % otp) | |
_send_salt_event('newotp') | |
log.debug('sleeping for %d seconds' % retry_int['interval'] ) | |
time.sleep(retry_int['interval']) | |
else: | |
log.debug('Success! OTP is %s' % otp) | |
log.debug('trying to join #%d' % i ) | |
result = _do_join(computername, realm, otp, server) | |
if result[0]: | |
break | |
log.debug('sleeping for %d seconds' % retry_int['interval'] ) | |
time.sleep(retry_int['interval']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment