Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
slapos
Commits
690b9b7e
Commit
690b9b7e
authored
Jul 31, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_bootstrap: add while/try for getConnection
parent
c6877aff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
+15
-6
No files found.
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
View file @
690b9b7e
...
...
@@ -7,6 +7,7 @@ import time
MAX_INSTALLATION_TIME = 60*30
MAX_TESTING_TIME = 60
MAX_GETTING_CONNECTION_TIME = 60*5
user = "%(user)s"
password = "%(password)s"
...
...
@@ -21,12 +22,20 @@ header_dict = {'Authorization': 'Basic %%s' %% \
def getConnection():
print "Getting new connection"
if protocol == 'https':
return httplib.HTTPSConnection(host)
elif protocol == 'http':
return httplib.HTTPConnection(host)
else:
raise ValueError("Protocol not implemented")
start_time = time.time()
count = 0
while MAX_GETTING_CONNECTION_TIME > time.time()-start_time:
try:
count = count + 1
if protocol == 'https':
return httplib.HTTPSConnection(host)
elif protocol == 'http':
return httplib.HTTPConnection(host)
else:
raise ValueError("Protocol not implemented")
except:
print "Getting new connection failed, retry"
raise ValueError("Cannot get new connection after %%d try (for %%s s)" %%(count, str(time.time()-start_time)))
def testIfExist(page, unexcepted_content="Site Error"):
print "Test if %%s exists" %%(page)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment