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
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
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
Show 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):
...
@@ -104,6 +104,7 @@ class Recipe(BaseSlapRecipe):
kvm_conf
[
'hostname'
]
=
"slaposkvm"
kvm_conf
[
'hostname'
]
=
"slaposkvm"
# Instanciate KVM
# Instanciate KVM
kvm_runner_path
=
self
.
instanciate
(
"kvm"
,
kvm_conf
)
kvm_runner_path
=
self
.
instanciate
(
"kvm"
,
kvm_conf
)
self
.
path_list
.
append
(
kvm_runner_path
)
self
.
path_list
.
append
(
kvm_runner_path
)
# Instanciate KVM controller
# Instanciate KVM controller
...
@@ -126,7 +127,10 @@ class Recipe(BaseSlapRecipe):
...
@@ -126,7 +127,10 @@ class Recipe(BaseSlapRecipe):
self
.
path_list
.
append
(
websockify_runner_path
)
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
Define the path to the wrapper of the thing you are instanciating
...
@@ -135,18 +139,16 @@ class Recipe(BaseSlapRecipe):
...
@@ -135,18 +139,16 @@ class Recipe(BaseSlapRecipe):
Returns : path to the running wrapper
Returns : path to the running wrapper
"""
"""
name_config
=
{}
name_config
.
update
(
self
.
options
)
for
e
in
list
:
config_dictionnary
.
update
(
self
.
options
)
name_config
[
'i'
]
=
i
name_
wrapper_template_location
=
pkg_resources
.
resource_filename
(
wrapper_template_location
=
pkg_resources
.
resource_filename
(
__name__
,
os
.
path
.
join
(
__name__
,
os
.
path
.
join
(
'template'
,
'name_run.in'
))
'template'
,
'name_run.in'
))
name_runner_path
=
self
.
createRunningWrapper
(
name
,
runner_path
=
self
.
createRunningWrapper
(
name
,
self
.
substituteTemplate
(
name_wrapper_template_location
,
name_config
))
self
.
substituteTemplate
(
wrapper_template_location
,
config_dictionnary
))
return
name_runner_path
return
name_runner_path
...
@@ -171,3 +173,5 @@ class Recipe(BaseSlapRecipe):
...
@@ -171,3 +173,5 @@ class Recipe(BaseSlapRecipe):
os
.
symlink
(
target
,
link
)
os
.
symlink
(
target
,
link
)
self
.
logger
.
debug
(
'Created link %r -> %r'
%
(
link
,
target
))
self
.
logger
.
debug
(
'Created link %r -> %r'
%
(
link
,
target
))
self
.
path_list
.
append
(
link
)
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