Skip to content

Commit

Permalink
Retry bootstrapping on every exception. rockstor#1026
Browse files Browse the repository at this point in the history
  • Loading branch information
schakrava committed Nov 30, 2015
1 parent 06c7c32 commit 39e60e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/rockstor/scripts/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ def main():
aw.api_call('network')
aw.api_call('commands/bootstrap', calltype='post')
break
except requests.exceptions.ConnectionError, e:
except Exception, e:
#Retry on every exception, primarily because of django-oauth related
#code behaving unpredictably while setting tokens. Retrying is a
#decent workaround for now(11302015).
if (num_attempts > 15):
print('Max attempts(15) reached. Connection errors persist. '
'Failed to bootstrap. Error: %s' % e.__str__())
sys.exit(1)
print('Connection error while bootstrapping. This could be because '
print('Exception occured while bootstrapping. This could be because '
'rockstor.service is still starting up. will wait 2 seconds '
'and try again.')
'and try again. Exception: %s' % e.__str__())
time.sleep(2)
num_attempts += 1
print('Bootstrapping complete')
Expand Down

0 comments on commit 39e60e7

Please sign in to comment.