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
Tom Niget
slapos
Commits
e4036db6
Commit
e4036db6
authored
Jul 01, 2011
by
Vivien Alger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring of instanciate function
parent
c0b1b311
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
slapos/recipe/kvm/__init__.py
slapos/recipe/kvm/__init__.py
+14
-10
No files found.
slapos/recipe/kvm/__init__.py
View file @
e4036db6
...
...
@@ -104,6 +104,7 @@ class Recipe(BaseSlapRecipe):
kvm_conf
[
'hostname'
]
=
"slaposkvm"
# Instanciate KVM
kvm_runner_path
=
self
.
instanciate
(
"kvm"
,
kvm_conf
)
self
.
path_list
.
append
(
kvm_runner_path
)
# Instanciate KVM controller
...
...
@@ -126,7 +127,10 @@ class Recipe(BaseSlapRecipe):
self
.
path_list
.
append
(
websockify_runner_path
)
def
instanciate
(
self
,
name
,
list
):
def
instanciate_Wrapper
(
self
,
name
,
config_dictionnary
):
"""
Define the path to the wrapper of the thing you are instanciating
...
...
@@ -135,19 +139,17 @@ class Recipe(BaseSlapRecipe):
Returns : path to the running wrapper
"""
name_config
=
{}
name_config
.
update
(
self
.
options
)
for
e
in
list
:
name_config
[
'i'
]
=
i
config_dictionnary
.
update
(
self
.
options
)
name_
wrapper_template_location
=
pkg_resources
.
resource_filename
(
wrapper_template_location
=
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
'template'
,
'name_run.in'
))
name_
runner_path
=
self
.
createRunningWrapper
(
name
,
self
.
substituteTemplate
(
name_wrapper_template_location
,
name_config
))
runner_path
=
self
.
createRunningWrapper
(
name
,
self
.
substituteTemplate
(
wrapper_template_location
,
config_dictionnary
))
return
name_runner_path
def
linkBinary
(
self
):
...
...
@@ -170,4 +172,6 @@ class Recipe(BaseSlapRecipe):
os
.
unlink
(
link
)
os
.
symlink
(
target
,
link
)
self
.
logger
.
debug
(
'Created link %r -> %r'
%
(
link
,
target
))
self
.
path_list
.
append
(
link
)
\ No newline at end of file
self
.
path_list
.
append
(
link
)
return
runner_path
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