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
Carlos Ramos Carreño
slapos
Commits
939b057e
Commit
939b057e
authored
Jul 04, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! bootstrap erp5: change the way to get zope password and username
parent
a49f7809
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
12 deletions
+62
-12
slapos/recipe/erp5_bootstrap/__init__.py
slapos/recipe/erp5_bootstrap/__init__.py
+46
-8
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
+14
-2
stack/erp5/buildout.cfg
stack/erp5/buildout.cfg
+1
-1
stack/erp5/instance-scalability.cfg.in
stack/erp5/instance-scalability.cfg.in
+1
-1
No files found.
slapos/recipe/erp5_bootstrap/__init__.py
View file @
939b057e
...
...
@@ -46,24 +46,62 @@ class Recipe(GenericBaseRecipe):
password
=
parsed
.
password
)
zope_parsed
=
urlparse
.
urlparse
(
self
.
options
[
'zope-url'
])
# Init zope configuration
zope_username
=
None
zope_password
=
None
zope_hostname
=
None
zope_port
=
None
zope_protocol
=
None
# Extract zope username/password from url, or get it from options
if
zope_parsed
.
username
:
zope_username
=
zope_parsed
.
username
# Get informations from zope url
if
self
.
options
.
get
(
'zope-url'
):
zope_parsed
=
urlparse
.
urlparse
(
self
.
options
[
'zope-url'
])
# Zope hostname
if
self
.
options
.
get
(
'zope-hostname'
):
zope_hostname
=
self
.
options
[
'zope-hostname'
]
elif
self
.
options
.
get
(
'zope-url'
):
zope_hostname
=
zope_parsed
.
hostname
else
:
zope_hostname
=
'localhost'
# Zope port
if
self
.
options
.
get
(
'zope-port'
):
zope_port
=
self
.
options
[
'zope-port'
]
elif
self
.
options
.
get
(
'zope-url'
):
zope_port
=
zope_parsed
.
port
else
:
zope_port
=
8080
# Zope username and password
if
self
.
options
.
get
(
'zope-username'
)
and
self
.
options
.
get
(
'zope-password'
):
zope_username
=
self
.
options
[
'zope-username'
]
if
zope_parsed
.
password
:
zope_password
=
self
.
options
[
'zope-password'
]
elif
self
.
options
.
get
(
'zope-url'
):
zope_username
=
zope_parsed
.
username
zope_password
=
zope_parsed
.
password
else
:
zope_password
=
self
.
options
[
'zope-password'
]
zope_username
=
'zope'
zope_password
=
'insecure'
# Zope protocol
if
self
.
options
.
get
(
'zope-protocol'
):
zope_protocol
=
self
.
options
[
'zope-protocol'
]
elif
self
.
options
.
get
(
'zope-url'
):
zope_protocol
=
zope_parsed
.
scheme
else
:
zope_protocol
=
'http'
# Zope site-id
if
self
.
options
.
get
(
'zope-site-id'
):
zope_site_id
=
self
.
options
[
'zope-site-id'
]
elif
self
.
options
.
get
(
'zope-url'
):
zope_site_id
=
zope_parsed
.
path
.
split
(
'/'
)[
1
],
else
:
zope_site_id
=
'erp5'
config
=
dict
(
python_path
=
sys
.
executable
,
user
=
zope_username
,
password
=
zope_password
,
site_id
=
zope_parsed
.
path
.
split
(
'/'
)[
1
],
host
=
"%s:%s"
%
(
zope_parsed
.
hostname
,
zope_parsed
.
port
),
site_id
=
zope_site_id
,
host
=
"%s:%s"
%
(
zope_hostname
,
zope_port
),
protocol
=
zope_protocol
,
sql_connection_string
=
mysql_connection_string
,
)
...
...
slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
View file @
939b057e
...
...
@@ -10,10 +10,17 @@ host = "%(host)s"
site_id = "%(site_id)s"
erp5_catalog_storage = 'erp5_mysql_innodb_catalog'
mysql_url = "%(sql_connection_string)s"
protocol = "%(protocol)s"
header_dict = {'Authorization': 'Basic %%s' %% \
base64.encodestring('%%s:%%s' %% (user, password)).strip()}
zope_connection = httplib.HTTPConnection(host)
if protocol == 'https':
zope_connection = httplib.HTTPSConnection(host)
elif protocol == 'http':
zope_connection = httplib.HTTPConnection(host)
else:
raise ValueError("Protocol '%s' is not implemented" %(protocol))
# Check if an ERP5 site is already created, as ERP5 does support having
# 2 instances in the same zope, and this script should not destroy user data
...
...
@@ -23,7 +30,12 @@ result = zope_connection.getresponse()
if result.status == 204: # and (result.read() == "False"):
# Use a new connection
if protocol == 'https':
zope_connection = httplib.HTTPSConnection(host)
elif protocol == 'http':
zope_connection = httplib.HTTPConnection(host)
else:
raise ValueError("Protocol '%s' is not implemented" %(protocol))
# Create the expected ERP5 instance
zope_connection.request(
...
...
stack/erp5/buildout.cfg
View file @
939b057e
...
...
@@ -329,7 +329,7 @@ md5sum = c745d794b28cae64feba527f894d7340
[template-scalability]
< = download-base
filename = instance-scalability.cfg.in
md5sum =
c8f9af16a3cf00c2f61c5cbdb1439c6e
md5sum =
761ff41d4f79cba89034a18aaf29ab27
[template-zeo]
< = download-base
...
...
stack/erp5/instance-scalability.cfg.in
View file @
939b057e
...
...
@@ -98,7 +98,7 @@ runner-path = ${basedirectory:services}/erp5-bootstrap
mysql-url = ${erp5-cluster:connection-mariadb-url}
zope-username = zope
zope-password = insecure
zope-url = ${erp5-cluster:connection-family-scalability}/
erp5
zope-url = ${erp5-cluster:connection-family-scalability}/
{{ site_id }}
[erp5-promise]
recipe = slapos.cookbook:erp5.promise
...
...
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