Commit 5afb8605 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

recipe/notifier: put back createCallback function

Also use better argument names. The function is used in pbs recipe and
was wrongly removed in 569439d5 commit.

See nexedi/slapos!739
parent b11c5ce7
...@@ -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_list):
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-directory'], callback_id), callback_list)
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-list'])
class Notify(GenericBaseRecipe): class Notify(GenericBaseRecipe):
......
  • This is a backward incompatible change. It is common for developpers (at least me) to have slapos.cookbook in develop mode (I'm not going into details, but there's a way to do this properly in webrunners).

    Backward incompatible changes are fine as long as they're atomic, as you can see in 569439d5 (BTW, sorry for having missed the pbs recipe).

  • Another reason why I'm against the release-cookbook script. It mixes unrelated things.

  • as you said, I couldn't do it properly with release-cookbook script as it is right now and using this script is mandatory now...

    Even without talking about the script, the fact that we need to push slapos.cookbook from 1.0 branch prevents to do atomic release.

    Anyway, I'll push merge !739 (merged) as soon as test result is OK so the problem won't last long.

  • as you said, I couldn't do it properly with release-cookbook script as it is right now and using this script is mandatory now...

    Even without talking about the script, the fact that we need to push slapos.cookbook from 1.0 branch prevents to do atomic release.

    All thing is plain ridiculous and I don't care.

    Edited by Julien Muchembled
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