Commit 030f718c authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

recipe/notifier: fix 569439d5 commit

 * put back createCallback function as it is used in pbs recipe.
 * fix section pbs in instance-pull-backup.cfg.in after change of
argument names.
 * fix the order of the 2 callbacks as the order is very important
parent f78116fe
......@@ -46,16 +46,18 @@ class Recipe(GenericBaseRecipe):
class Callback(GenericBaseRecipe):
def install(self):
options = self.options
notification_id = options['on-notification-id']
# Note: this function is also used in pbs recipe
def createCallback(self, notification_id, callbacks_list):
# XXX: hashing the name here and in
# slapos.toolbox/slapos/pubsub/__init__.py is completely messed up and
# prevent any debug.
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),
options['callbacks'])
def install(self):
options = self.options
notification_id = options['on-notification-id']
return self.createCallback(notification_id, options['callbacks-list'])
class Notify(GenericBaseRecipe):
......
......@@ -14,11 +14,11 @@
# not need these here).
[pbsready]
filename = pbsready.cfg.in
md5sum = 66331047b7dbf2513c5726d5d1647320
md5sum = 5b2fe1b35f6c8eaed0a0e6a10dc12cfe
[pbsready-import]
filename = pbsready-import.cfg.in
md5sum = 6f32cede10cf0d6430c017f49fe5aa30
md5sum = fdf64dc6d3ecf457c91e32dca91362b0
[pbsready-export]
filename = pbsready-export.cfg.in
......@@ -26,7 +26,7 @@ md5sum = 2b0c71b085cfe8017f28098c160b1f49
[template-pull-backup]
filename = instance-pull-backup.cfg.in
md5sum = 555d528b198564f0ce1e94db1160ebf3
md5sum = ca195935e53e033eed72b6b1f5be6bc9
[template-replicated]
filename = template-replicated.cfg.in
......
......@@ -110,7 +110,7 @@ rotate-num = 30
recipe = slapos.cookbook:pbs
client = true
feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks}
callbacks-directory = $${directory:notifier-callbacks}
equeue-socket = $${equeue:socket}
notifier-binary = ${buildout:bin-directory}/pubsubnotifier
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
......
......@@ -42,13 +42,15 @@ ip = $${notifier:host}
# notifier.callback runs a script when a notification (sent by a parent PBS)
# is received
recipe = slapos.cookbook:notifier.callback
directory = $${notifier:callbacks}
callbacks-directory = $${notifier:callbacks-directory}
on-notification-id = $${slap-parameter:on-notification}
callbacks =
# import on notification
$${importer:wrapper}
callbacks-list =
# warning the order of the 2 callbacks is important for now
# it should be fixed later
# check backup integrity on notification
$${post-notification-run:output}
# import on notification
$${importer:wrapper}
[post-notification-run]
recipe = collective.recipe.template
......
......@@ -131,8 +131,8 @@ rendered = $${:wrapper}
wrapper = $${basedirectory:services}/notifier
mode = 0700
feeds = $${directory:notifier-feeds}
callbacks = $${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}
callbacks-directory = $${directory:notifier-callbacks}
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
host = $${slap-network-information:global-ipv6}
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