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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
slapos
Commits
c153fd95
Commit
c153fd95
authored
Jul 31, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_bootstrap: add more connection controls
parent
ea791b99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
25 deletions
+45
-25
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
+45
-25
No files found.
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
View file @
c153fd95
...
@@ -6,7 +6,7 @@ import base64
...
@@ -6,7 +6,7 @@ import base64
import time
import time
MAX_INSTALLATION_TIME = 60*30
MAX_INSTALLATION_TIME = 60*30
MAX_TESTING_TIME = 60
MAX_TESTING_TIME = 60
*2
MAX_GETTING_CONNECTION_TIME = 60*5
MAX_GETTING_CONNECTION_TIME = 60*5
user = "%(user)s"
user = "%(user)s"
...
@@ -33,41 +33,61 @@ def getConnection():
...
@@ -33,41 +33,61 @@ def getConnection():
return httplib.HTTPConnection(host)
return httplib.HTTPConnection(host)
else:
else:
raise ValueError("Protocol not implemented")
raise ValueError("Protocol not implemented")
except:
except:
print "Getting new connection failed, retry"
print "Getting new connection failed, retry"
time.sleep(10)
raise ValueError("Cannot get new connection after %%d try (for %%s s)" %%(count, str(time.time()-start_time)))
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)
zope_connection = getConnection()
start_time = time.time()
zope_connection.request('GET', '/%%s/%%s' %%(site_id, page))
count = 0
result = zope_connection.getresponse()
while MAX_TESTING_TIME > time.time()-start_time:
return not unexcepted_content in result.read()
try:
count = count + 1
zope_connection = getConnection()
zope_connection.request('GET', '/%%s/%%s' %%(site_id, page))
result = zope_connection.getresponse()
return not unexcepted_content in result.read()
except:
print "Test if exists failed, retry..."
time.sleep(10)
raise ValueError("Cannot testIfExist after %%d try (for %%s s)" %%(count, str(time.time()-start_time)))
def waitFor0PendingActivities():
def waitFor0PendingActivities():
# TODO: tolerate 1 pending activities ? (mail server...)
# TODO: tolerate 1 pending activities ? (mail server...)
print "waitFor0PendingActivities.."
print "waitFor0PendingActivities.."
start_time = time.time()
start_time = time.time()
count = 0
while MAX_INSTALLATION_TIME > time.time()-start_time:
while MAX_INSTALLATION_TIME > time.time()-start_time:
zope_connection = getConnection()
try:
zope_connection.request(
count = count + 1
'GET', '/%%s/portal_activities/getMessageList' %%(site_id),
zope_connection = getConnection()
headers=header_dict
zope_connection.request(
)
'GET', '/%%s/portal_activities/getMessageList' %%(site_id),
result = zope_connection.getresponse()
headers=header_dict
message_list_text = result.read()
)
message_list = [s.strip() for s in message_list_text[1:-1].split(',')]
result = zope_connection.getresponse()
if len(message_list)==0:
message_list_text = result.read()
print "There is no pending activities."
message_list = [s.strip() for s in message_list_text[1:-1].split(',')]
break
if len(message_list)==0:
print "There is %%d pending activities" %%len(message_list)
print "There is no pending activities."
time.sleep(5)
break
print "There is %%d pending activities" %%len(message_list)
time.sleep(5)
#Hack to do not take into account persistent Alarm_installMailServer acitivities
if len(message_list)==0 and testIfExist("/%%s/portal_activities" %%site_id, "Alarm_installMailServer"):
print "1 pending activity for 'Alarm_installMailServer'."
print "ok."
break
except:
time.sleep(5)
print "Getting activities failed, retry."
raise ValueError("Cannot testIfExist after %%d try (for %%s s)" %%(count, str(time.time()-start_time)))
#Hack to do not take into account persistent Alarm_installMailServer acitivities
if len(message_list)==0 and testIfExist("/%%s/portal_activities" %%site_id, "Alarm_installMailServer"):
print "1 pending activity for 'Alarm_installMailServer'."
print "ok."
break
# Check if an ERP5 site is already created, as ERP5 does support having
# Check if an ERP5 site is already created, as ERP5 does support having
...
...
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