Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
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
Show 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
...
@@ -7,6 +7,7 @@ import time
MAX_INSTALLATION_TIME = 60*30
MAX_INSTALLATION_TIME = 60*30
MAX_TESTING_TIME = 60
MAX_TESTING_TIME = 60
MAX_GETTING_CONNECTION_TIME = 60*5
user = "%(user)s"
user = "%(user)s"
password = "%(password)s"
password = "%(password)s"
...
@@ -21,12 +22,20 @@ header_dict = {'Authorization': 'Basic %%s' %% \
...
@@ -21,12 +22,20 @@ header_dict = {'Authorization': 'Basic %%s' %% \
def getConnection():
def getConnection():
print "Getting new connection"
print "Getting new connection"
start_time = time.time()
count = 0
while MAX_GETTING_CONNECTION_TIME > time.time()-start_time:
try:
count = count + 1
if protocol == 'https':
if protocol == 'https':
return httplib.HTTPSConnection(host)
return httplib.HTTPSConnection(host)
elif protocol == 'http':
elif protocol == 'http':
return httplib.HTTPConnection(host)
return httplib.HTTPConnection(host)
else:
else:
raise ValueError("Protocol not implemented")
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"):
def testIfExist(page, unexcepted_content="Site Error"):
print "Test if %%s exists" %%(page)
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