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
50988e56
Commit
50988e56
authored
Mar 20, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update wrapper recipe to make it simpler and more dev-friendly.
parent
d0aebea0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
slapos/recipe/wrapper.py
slapos/recipe/wrapper.py
+14
-7
No files found.
slapos/recipe/wrapper.py
View file @
50988e56
...
@@ -30,25 +30,32 @@ import shlex
...
@@ -30,25 +30,32 @@ import shlex
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
slapos.recipe.librecipe
import
GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
def
install
(
self
):
command_line
=
shlex
.
split
(
self
.
options
[
'command-line'
])
command_line
=
shlex
.
split
(
self
.
options
[
'command-line'
])
wrapper_path
=
self
.
options
[
'wrapper-path'
]
wait_files
=
self
.
options
.
get
(
'wait-for-files'
)
wait_files
=
self
.
options
.
get
(
'wait-for-files'
)
environment
=
self
.
options
.
get
(
'environment'
)
if
not
wait_files
and
not
environment
:
# Create a simple wrapper as shell script
return
[
self
.
createWrapper
(
name
=
wrapper_path
,
command
=
command_line
[
0
],
parameters
=
command_line
[
1
:],
)]
# More complex needs: create a Python script as wrapper
if
wait_files
is
not
None
:
if
wait_files
is
not
None
:
wait_files
=
[
filename
.
strip
()
for
filename
in
wait_files
.
split
()
wait_files
=
[
filename
.
strip
()
for
filename
in
wait_files
.
split
()
if
filename
.
strip
()]
if
filename
.
strip
()]
environment
=
self
.
options
.
get
(
'environment'
)
if
environment
is
not
None
:
if
environment
is
not
None
:
environment
=
dict
((
k
.
strip
(),
v
.
strip
())
for
k
,
v
in
[
environment
=
dict
((
k
.
strip
(),
v
.
strip
())
for
k
,
v
in
[
line
.
split
(
'='
)
line
.
split
(
'='
)
for
line
in
environment
.
split
(
'
\
n
'
)
for
line
in
environment
.
split
(
'
\
n
'
)
])
])
return
[
self
.
createPythonScript
(
return
[
self
.
createPythonScript
(
self
.
options
[
'output'
]
,
wrapper_path
,
'slapos.recipe.librecipe.execute.generic_exec'
,
'slapos.recipe.librecipe.execute.generic_exec'
,
(
command_line
,
wait_files
,
environment
,),
(
command_line
,
wait_files
,
environment
,),
)]
)]
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