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
b9fca014
Commit
b9fca014
authored
Oct 05, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to send env variable and custom config to apache recipe
parent
25c5fba2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
18 deletions
+41
-18
slapos/recipe/apachephp/__init__.py
slapos/recipe/apachephp/__init__.py
+41
-18
No files found.
slapos/recipe/apachephp/__init__.py
View file @
b9fca014
...
...
@@ -33,6 +33,27 @@ from slapos.recipe.librecipe import GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
environ
=
{}
environment_section
=
options
.
get
(
'environment-section'
,
''
).
strip
()
if
environment_section
and
environment_section
in
buildout
:
# Use environment variables from the designated config section.
self
.
environ
.
update
(
buildout
[
environment_section
])
for
variable
in
options
.
get
(
'environment'
,
''
).
splitlines
():
if
variable
.
strip
():
try
:
key
,
value
=
variable
.
split
(
'='
,
1
)
self
.
environ
[
key
.
strip
()]
=
value
except
ValueError
:
raise
zc
.
buildout
.
UserError
(
'Invalid environment variable definition: %s'
,
variable
)
# Extrapolate the environment variables using values from the current
# environment.
for
key
in
self
.
environ
:
self
.
environ
[
key
]
=
self
.
environ
[
key
]
%
os
.
environ
return
GenericBaseRecipe
.
__init__
(
self
,
buildout
,
name
,
options
)
def
install
(
self
):
path_list
=
[]
...
...
@@ -50,6 +71,7 @@ class Recipe(GenericBaseRecipe):
path_list
.
append
(
php_ini
)
# Install apache
if
self
.
optionIsTrue
(
'default-conf'
,
True
):
apache_config
=
dict
(
pid_file
=
self
.
options
[
'pid-file'
],
lock_file
=
self
.
options
[
'lock-file'
],
...
...
@@ -66,10 +88,11 @@ class Recipe(GenericBaseRecipe):
)
path_list
.
append
(
httpd_conf
)
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.execute'
,
[
self
.
options
[
'httpd-binary'
],
'-f'
,
self
.
options
[
'httpd-conf'
],
apache_args
=
[
self
.
options
[
'httpd-binary'
],
'-f'
,
self
.
options
[
'httpd-conf'
],
'-DFOREGROUND'
]
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'slapos.recipe.librecipe.execute.executee'
,
(
apache_args
,
self
.
environ
)
)
path_list
.
append
(
wrapper
)
...
...
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