Commit e4036db6 authored by Vivien Alger's avatar Vivien Alger

Refactoring of instanciate function

parent c0b1b311
No related merge requests found
...@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment