Commit a5d31970 authored by Julien Muchembled's avatar Julien Muchembled

Remove 'comments' parameter in GenericBaseRecipe.createWrapper

It was used in only 2 places and createPythonScript has no equivalent
(maybe reusing 'initialization' from easy_install would produce something
readable enough). For the moment, let's drop this parameter, so that
createWrapper can switch to Python wrappers for complex cases.
parent 5c980caf
......@@ -136,9 +136,7 @@ class GenericBaseRecipe(object):
[(filename, module, function)], self._ws, sys.executable,
path, arguments=', '.join(args))[0]
def createWrapper(self, name, command, parameters, comments=(),
environment=None,
):
def createWrapper(self, name, command, parameters, environment=None):
"""
Creates a basic shell script for process replacement.
Takes care of quoting.
......@@ -150,9 +148,6 @@ class GenericBaseRecipe(object):
"""
lines = [ '#!/bin/sh' ]
if comments:
lines += '# ', '\n# '.join(comments), '\n'
for key in environment or ():
lines.append('export %s=%s' % (key, shlex.quote(environment[key])))
......
......@@ -32,6 +32,7 @@ class Recipe(GenericBaseRecipe):
def install(self):
options = self.options
# Script that execute the callback(s) upon receiving a notification.
script = self.createWrapper(name=options['wrapper'],
command=options['server-binary'],
parameters=[
......@@ -40,10 +41,7 @@ class Recipe(GenericBaseRecipe):
'--equeue-socket', options['equeue-socket'],
options['host'], options['port']
],
comments=[
'',
'Upon receiving a notification, execute the callback(s).',
''])
)
return [script]
......@@ -105,13 +103,11 @@ class Notify(GenericBaseRecipe):
'slapos.recipe.librecipe.execute.generic_exec',
(cmd,), {'pidfile': pidfile})
# Script that call an executable and send notification(s).
return self.createWrapper(name=wrapper,
command=cmd[0],
parameters=cmd[1:],
comments=[
'',
'Call an executable and send notification(s).',
''])
)
def install(self):
......
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