Commit 137b2fd5 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.

Also fix section pbs in instance-pull-backup.cfg.in after change of
argument names.
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, callbacks_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), callbacks_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['callbacks-list'])
class Notify(GenericBaseRecipe): class Notify(GenericBaseRecipe):
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
# not need these here). # not need these here).
[pbsready] [pbsready]
filename = pbsready.cfg.in filename = pbsready.cfg.in
md5sum = 66331047b7dbf2513c5726d5d1647320 md5sum = 5b2fe1b35f6c8eaed0a0e6a10dc12cfe
[pbsready-import] [pbsready-import]
filename = pbsready-import.cfg.in filename = pbsready-import.cfg.in
md5sum = 6f32cede10cf0d6430c017f49fe5aa30 md5sum = 575320de2d25d43abc04db402ee3dea3
[pbsready-export] [pbsready-export]
filename = pbsready-export.cfg.in filename = pbsready-export.cfg.in
...@@ -26,7 +26,7 @@ md5sum = 2b0c71b085cfe8017f28098c160b1f49 ...@@ -26,7 +26,7 @@ md5sum = 2b0c71b085cfe8017f28098c160b1f49
[template-pull-backup] [template-pull-backup]
filename = instance-pull-backup.cfg.in filename = instance-pull-backup.cfg.in
md5sum = 555d528b198564f0ce1e94db1160ebf3 md5sum = ca195935e53e033eed72b6b1f5be6bc9
[template-replicated] [template-replicated]
filename = template-replicated.cfg.in filename = template-replicated.cfg.in
......
...@@ -110,7 +110,7 @@ rotate-num = 30 ...@@ -110,7 +110,7 @@ rotate-num = 30
recipe = slapos.cookbook:pbs recipe = slapos.cookbook:pbs
client = true client = true
feeds = $${directory:notifier-feeds} feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks} callbacks-directory = $${directory:notifier-callbacks}
equeue-socket = $${equeue:socket} equeue-socket = $${equeue:socket}
notifier-binary = ${buildout:bin-directory}/pubsubnotifier notifier-binary = ${buildout:bin-directory}/pubsubnotifier
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
......
...@@ -42,9 +42,9 @@ ip = $${notifier:host} ...@@ -42,9 +42,9 @@ ip = $${notifier:host}
# notifier.callback runs a script when a notification (sent by a parent PBS) # notifier.callback runs a script when a notification (sent by a parent PBS)
# is received # is received
recipe = slapos.cookbook:notifier.callback recipe = slapos.cookbook:notifier.callback
directory = $${notifier:callbacks} callbacks-directory = $${notifier:callbacks-directory}
on-notification-id = $${slap-parameter:on-notification} on-notification-id = $${slap-parameter:on-notification}
callbacks = callbacks-list =
# import on notification # import on notification
$${importer:wrapper} $${importer:wrapper}
# check backup integrity on notification # check backup integrity on notification
......
...@@ -131,8 +131,8 @@ rendered = $${:wrapper} ...@@ -131,8 +131,8 @@ rendered = $${:wrapper}
wrapper = $${basedirectory:services}/notifier wrapper = $${basedirectory:services}/notifier
mode = 0700 mode = 0700
feeds = $${directory:notifier-feeds} feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks} callbacks-directory = $${directory:notifier-callbacks}
command = ${buildout:bin-directory}/pubsubserver --callbacks $${directory:notifier-callbacks} --feeds $${directory:notifier-feeds} --equeue-socket $${equeue:socket} --logfile $${basedirectory:log}/notifier.log $${:host} $${:port} command = ${buildout:bin-directory}/pubsubserver --callbacks $${:callbacks-directory} --feeds $${:feeds} --equeue-socket $${equeue:socket} --logfile $${basedirectory:log}/notifier.log $${:host} $${:port}
notifier-binary = ${buildout:bin-directory}/pubsubnotifier notifier-binary = ${buildout:bin-directory}/pubsubnotifier
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
port = $${notifier-port:port} port = $${notifier-port:port}
......
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