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): ...@@ -136,9 +136,7 @@ class GenericBaseRecipe(object):
[(filename, module, function)], self._ws, sys.executable, [(filename, module, function)], self._ws, sys.executable,
path, arguments=', '.join(args))[0] path, arguments=', '.join(args))[0]
def createWrapper(self, name, command, parameters, comments=(), def createWrapper(self, name, command, parameters, environment=None):
environment=None,
):
""" """
Creates a basic shell script for process replacement. Creates a basic shell script for process replacement.
Takes care of quoting. Takes care of quoting.
...@@ -150,9 +148,6 @@ class GenericBaseRecipe(object): ...@@ -150,9 +148,6 @@ class GenericBaseRecipe(object):
""" """
lines = [ '#!/bin/sh' ] lines = [ '#!/bin/sh' ]
if comments:
lines += '# ', '\n# '.join(comments), '\n'
for key in environment or (): for key in environment or ():
lines.append('export %s=%s' % (key, shlex.quote(environment[key]))) lines.append('export %s=%s' % (key, shlex.quote(environment[key])))
......
...@@ -32,6 +32,7 @@ class Recipe(GenericBaseRecipe): ...@@ -32,6 +32,7 @@ class Recipe(GenericBaseRecipe):
def install(self): def install(self):
options = self.options options = self.options
# Script that execute the callback(s) upon receiving a notification.
script = self.createWrapper(name=options['wrapper'], script = self.createWrapper(name=options['wrapper'],
command=options['server-binary'], command=options['server-binary'],
parameters=[ parameters=[
...@@ -40,10 +41,7 @@ class Recipe(GenericBaseRecipe): ...@@ -40,10 +41,7 @@ class Recipe(GenericBaseRecipe):
'--equeue-socket', options['equeue-socket'], '--equeue-socket', options['equeue-socket'],
options['host'], options['port'] options['host'], options['port']
], ],
comments=[ )
'',
'Upon receiving a notification, execute the callback(s).',
''])
return [script] return [script]
...@@ -105,13 +103,11 @@ class Notify(GenericBaseRecipe): ...@@ -105,13 +103,11 @@ class Notify(GenericBaseRecipe):
'slapos.recipe.librecipe.execute.generic_exec', 'slapos.recipe.librecipe.execute.generic_exec',
(cmd,), {'pidfile': pidfile}) (cmd,), {'pidfile': pidfile})
# Script that call an executable and send notification(s).
return self.createWrapper(name=wrapper, return self.createWrapper(name=wrapper,
command=cmd[0], command=cmd[0],
parameters=cmd[1:], parameters=cmd[1:],
comments=[ )
'',
'Call an executable and send notification(s).',
''])
def install(self): 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