Commit 31f52d2e authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

recipe/notifier: put back createCallback function

createCallback is used in pbs recipe.

The function was wrongly removed in
569439d5.
parent f78116fe
...@@ -46,16 +46,18 @@ class Recipe(GenericBaseRecipe): ...@@ -46,16 +46,18 @@ class Recipe(GenericBaseRecipe):
class Callback(GenericBaseRecipe): class Callback(GenericBaseRecipe):
def install(self): # Note: this function is also used in pbs recipe
options = self.options def createCallback(self, notification_id, callback):
notification_id = options['on-notification-id']
# XXX: hashing the name here and in # XXX: hashing the name here and in
# slapos.toolbox/slapos/pubsub/__init__.py is completely messed up and # slapos.toolbox/slapos/pubsub/__init__.py is completely messed up and
# prevent any debug. # prevent any debug.
callback_id = sha512(str2bytes(notification_id)).hexdigest() callback_id = sha512(str2bytes(notification_id)).hexdigest()
return self.createFile(os.path.join(self.options['callbacks'], callback_id), callback)
return self.createFile(os.path.join(options['directory'], callback_id), def install(self):
options['callbacks']) options = self.options
notification_id = options['on-notification-id']
return self.createCallback(notification_id, options['callback'])
class Notify(GenericBaseRecipe): class Notify(GenericBaseRecipe):
......
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