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
Boxiang Sun
slapos
Commits
a68cf495
Commit
a68cf495
authored
Oct 19, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fill template.
parent
249e014b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
slapos/recipe/generate_erp5_tidstorage.py
slapos/recipe/generate_erp5_tidstorage.py
+17
-3
No files found.
slapos/recipe/generate_erp5_tidstorage.py
View file @
a68cf495
...
@@ -42,6 +42,12 @@ class Recipe(GenericSlapRecipe):
...
@@ -42,6 +42,12 @@ class Recipe(GenericSlapRecipe):
def
_generateRealTemplate
(
self
):
def
_generateRealTemplate
(
self
):
current_zeo_port
=
ZEO_PORT_BASE
current_zeo_port
=
ZEO_PORT_BASE
current_zope_port
=
ZOPE_PORT_BASE
current_zope_port
=
ZOPE_PORT_BASE
current_apache_port
=
APACHE_PORT_BASE
current_haproxy_port
=
HAPROXY_PORT_BASE
num
=
1
for
l
in
self
.
parameter_dict
[
'json'
].
splitlines
():
print
'%3s %s'
%
(
num
,
l
)
num
+=
1
json_data
=
json
.
loads
(
self
.
parameter_dict
[
'json'
])
json_data
=
json
.
loads
(
self
.
parameter_dict
[
'json'
])
site_id
=
str
(
json_data
[
'site-id'
])
site_id
=
str
(
json_data
[
'site-id'
])
# prepare zeo
# prepare zeo
...
@@ -102,15 +108,23 @@ class Recipe(GenericSlapRecipe):
...
@@ -102,15 +108,23 @@ class Recipe(GenericSlapRecipe):
**
zope_dict
)
**
zope_dict
)
# handle backend key
# handle backend key
snippet_backend
=
open
(
self
.
options
[
'snippet-backend'
]).
read
()
snippet_backend
=
open
(
self
.
options
[
'snippet-backend'
]).
read
()
for
backend_
typ
e
,
backend_configuration
in
json_data
[
'backend'
].
iteritems
():
for
backend_
nam
e
,
backend_configuration
in
json_data
[
'backend'
].
iteritems
():
for
q
in
range
(
1
,
backend_configuration
[
'zopecount'
]
+
1
):
for
q
in
range
(
1
,
backend_configuration
[
'zopecount'
]
+
1
):
current_zope_port
+=
1
current_zope_port
+=
1
part_name
=
'zope-%s-%s'
%
(
backend_
typ
e
,
q
)
part_name
=
'zope-%s-%s'
%
(
backend_
nam
e
,
q
)
part_list
.
append
(
part_name
)
part_list
.
append
(
part_name
)
output
+=
snippet_zope
%
dict
(
zope_thread_amount
=
backend_configuration
[
'thread-amount'
],
zope_id
=
part_name
,
zope_port
=
current_zope_port
,
**
zope_dict
)
output
+=
snippet_zope
%
dict
(
zope_thread_amount
=
backend_configuration
[
'thread-amount'
],
zope_id
=
part_name
,
zope_port
=
current_zope_port
,
**
zope_dict
)
# now generate backend access
# now generate backend access
part_list
.
append
(
'apache-%(backend_name)s ca-apache-%(backend_name)s logrotate-entry-apache-%(backend_name)s haproxy-%(backend_name)s'
%
dict
(
backend_name
=
backend_type
))
current_apache_port
+=
1
current_haproxy_port
+=
1
part_list
.
append
(
'apache-%(backend_name)s ca-apache-%(backend_name)s logrotate-entry-apache-%(backend_name)s haproxy-%(backend_name)s'
%
dict
(
backend_name
=
backend_name
))
backend_dict
=
dict
(
backend_dict
=
dict
(
backend_name
=
backend_name
,
apache_port
=
current_apache_port
,
haproxy_port
=
current_haproxy_port
,
access_control_string
=
backend_configuration
[
'access-control-string'
],
maxconn
=
backend_configuration
[
'maxconn'
],
server_check_path
=
'/%s/getId'
%
site_id
)
)
output
+=
snippet_backend
%
backend_dict
output
+=
snippet_backend
%
backend_dict
prepend
=
open
(
self
.
options
[
'snippet-master'
]).
read
()
%
dict
(
prepend
=
open
(
self
.
options
[
'snippet-master'
]).
read
()
%
dict
(
...
...
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