Commit b9ec1175 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

resilience: fix after switching to switch-softwaretype recipe

This was broken in 8725ab1a.

 * recipe/pbs: slave-instance-list is already a list of JSON
 * slave-instance-list is not a configuration but directly a parameter
from slapos
parent 137b2fd5
...@@ -57,7 +57,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -57,7 +57,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
def _options(self, options): def _options(self, options):
options['rdiff-backup-data-folder'] = "" options['rdiff-backup-data-folder'] = ""
if 'slave-instance-list' in options: if 'slave-instance-list' in options:
for slave in json.loads(options['slave-instance-list']): for slave in options['slave-instance-list']:
if slave['type'] == 'pull': if slave['type'] == 'pull':
options['rdiff-backup-data-folder'] = str(os.path.join(options['directory'], slave['name'], 'rdiff-backup-data')) options['rdiff-backup-data-folder'] = str(os.path.join(options['directory'], slave['name'], 'rdiff-backup-data'))
...@@ -299,8 +299,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -299,8 +299,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
if self.optionIsTrue('client', True): if self.optionIsTrue('client', True):
self.logger.info("Client mode") self.logger.info("Client mode")
slaves = self.options['slave-instance-list']
slaves = json.loads(self.options['slave-instance-list'])
known_hosts = KnownHostsFile(self.options['known-hosts']) known_hosts = KnownHostsFile(self.options['known-hosts'])
with known_hosts: with known_hosts:
for slave in slaves: for slave in slaves:
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# not need these here). # not need these here).
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = ec70348dd71b319590a5c5837f3d2e45 md5sum = 8d6878ff1d2e75010c50a1a2b0c13b24
[template-runner] [template-runner]
filename = instance-runner.cfg filename = instance-runner.cfg
......
...@@ -74,6 +74,7 @@ template = ${instance-runner-import:target} ...@@ -74,6 +74,7 @@ template = ${instance-runner-import:target}
rendered = $${buildout:directory}/instance-runner-import.cfg rendered = $${buildout:directory}/instance-runner-import.cfg
mode = 640 mode = 640
context = context =
key pbsready_import_template_path template-pbsready-import:rendered
key template_runner_path instance-base-runner:rendered key template_runner_path instance-base-runner:rendered
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
raw software_release_bin ${buildout:bin-directory} raw software_release_bin ${buildout:bin-directory}
...@@ -82,7 +83,6 @@ context = ...@@ -82,7 +83,6 @@ context =
raw bash_executable_location ${bash:location}/bin/bash raw bash_executable_location ${bash:location}/bin/bash
raw sqlite3_executable_location ${sqlite3:location}/bin/sqlite3 raw sqlite3_executable_location ${sqlite3:location}/bin/sqlite3
raw rsync_executable_location ${rsync:location}/bin/rsync raw rsync_executable_location ${rsync:location}/bin/rsync
raw pbsready_import_template_path ${pbsready-import:output}
raw software_release_information_template ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename} raw software_release_information_template ${template-resilient-software-release-information:destination}/${template-resilient-software-release-information:filename}
[slap-configuration] [slap-configuration]
......
...@@ -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 = 5b2fe1b35f6c8eaed0a0e6a10dc12cfe md5sum = 2bd6f853ace04ea84dffe29acfce92df
[pbsready-import] [pbsready-import]
filename = pbsready-import.cfg.in filename = pbsready-import.cfg.in
md5sum = 575320de2d25d43abc04db402ee3dea3 md5sum = 7e0634844a4e2450d428c00f39ca32d0
[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 = ca195935e53e033eed72b6b1f5be6bc9 md5sum = 382d9b57faac92da3c723760f2210c13
[template-replicated] [template-replicated]
filename = template-replicated.cfg.in filename = template-replicated.cfg.in
...@@ -38,7 +38,7 @@ md5sum = 071b1034ee8f5cc14f79b16fdeba2813 ...@@ -38,7 +38,7 @@ md5sum = 071b1034ee8f5cc14f79b16fdeba2813
[template-resilient-templates] [template-resilient-templates]
filename = template-resilient-templates.cfg.in filename = template-resilient-templates.cfg.in
md5sum = 097a14371efde11465ab4bd08ef3131b md5sum = 3b426db6fddce431b363d095a22dd698
[instance-frozen] [instance-frozen]
filename = instance-frozen.cfg.in filename = instance-frozen.cfg.in
......
...@@ -124,7 +124,7 @@ run-directory = $${basedirectory:run} ...@@ -124,7 +124,7 @@ run-directory = $${basedirectory:run}
pull-push-maximum-run = 5 pull-push-maximum-run = 5
# XXX: this should be named "notifier-host" # XXX: this should be named "notifier-host"
notifier-url = http://[$${notifier:host}]:$${notifier:port} notifier-url = http://[$${notifier:host}]:$${notifier:port}
slave-instance-list = {{ slapparameter_dict.get('slave_instance_list', '[]') }} slave-instance-list = {{ dumps(slave_instance_list) }}
ignore-known-hosts-file = {{ slapparameter_dict.get('ignore-known-hosts-file', 'false') }} ignore-known-hosts-file = {{ slapparameter_dict.get('ignore-known-hosts-file', 'false') }}
# To get a verbose feed about PBS state # To get a verbose feed about PBS state
instance-root-name = $${monitor-instance-parameter:root-instance-title} instance-root-name = $${monitor-instance-parameter:root-instance-title}
......
[buildout] [buildout]
extends = ${pbsready:output} extends = {{ pbsready_template_path }}
parts += parts +=
resiliency-takeover-script resiliency-takeover-script
...@@ -14,9 +14,6 @@ parts += ...@@ -14,9 +14,6 @@ parts +=
backup-signature-link backup-signature-link
[slap-parameter]
on-notification =
[resilient-publish-connection-parameter] [resilient-publish-connection-parameter]
notification-url = http://[$${notifier:host}]:$${notifier:port}/notify notification-url = http://[$${notifier:host}]:$${notifier:port}/notify
takeover-url = http://[$${resilient-web-takeover-httpd-configuration-file:listening-ip}]:$${resilient-web-takeover-httpd-configuration-file:listening-port}/ takeover-url = http://[$${resilient-web-takeover-httpd-configuration-file:listening-ip}]:$${resilient-web-takeover-httpd-configuration-file:listening-port}/
...@@ -43,7 +40,7 @@ ip = $${notifier:host} ...@@ -43,7 +40,7 @@ ip = $${notifier:host}
# is received # is received
recipe = slapos.cookbook:notifier.callback recipe = slapos.cookbook:notifier.callback
callbacks-directory = $${notifier:callbacks-directory} callbacks-directory = $${notifier:callbacks-directory}
on-notification-id = $${slap-parameter:on-notification} on-notification-id = {{ slapparameter_dict.get('on-notification', '') }}
callbacks-list = callbacks-list =
# import on notification # import on notification
$${importer:wrapper} $${importer:wrapper}
......
...@@ -63,9 +63,6 @@ cgi-bin = $${rootdirectory:srv}/cgi-bin ...@@ -63,9 +63,6 @@ cgi-bin = $${rootdirectory:srv}/cgi-bin
monitor-resilient = $${monitor-directory:private}/resilient monitor-resilient = $${monitor-directory:private}/resilient
[slap-parameter]
authorized-key =
#---------------- #----------------
#-- #--
#-- Deploy cron. #-- Deploy cron.
...@@ -198,7 +195,7 @@ wrapper-path = $${rootdirectory:bin}/raw_sshd ...@@ -198,7 +195,7 @@ wrapper-path = $${rootdirectory:bin}/raw_sshd
[sshd-pbs-authorized-key] [sshd-pbs-authorized-key]
<= sshd-raw-server <= sshd-raw-server
recipe = slapos.cookbook:dropbear.add_authorized_key recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key} key = {{ slapparameter_dict.get('authorized-key', '') }}
[sshd-server] [sshd-server]
recipe = collective.recipe.template recipe = collective.recipe.template
......
[template-pbsready]
recipe = slapos.recipe.template:jinja2
template = ${pbsready:output}
rendered = $${buildout:directory}/pbsready.cfg
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
[template-pbsready-export] [template-pbsready-export]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${pbsready-export:target} template = ${pbsready-export:target}
...@@ -5,10 +13,19 @@ rendered = $${buildout:directory}/pbsready-exporter.cfg ...@@ -5,10 +13,19 @@ rendered = $${buildout:directory}/pbsready-exporter.cfg
mode = 640 mode = 640
context = context =
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
raw pbsready_template_path ${pbsready:output} raw pbsready_template_path $${template-pbsready:rendered}
raw bash_executable_location ${bash:location}/bin/bash raw bash_executable_location ${bash:location}/bin/bash
raw logrotate_executable_location ${logrotate:location}/usr/sbin/logrotate raw logrotate_executable_location ${logrotate:location}/usr/sbin/logrotate
[template-pbsready-import]
recipe = slapos.recipe.template:jinja2
template = ${pbsready-import:output}
rendered = $${buildout:directory}/pbsready-importer.cfg
extensions = jinja2.ext.do
context =
key slapparameter_dict slap-configuration:configuration
raw pbsready_template_path $${template-pbsready:rendered}
[instance-frozen] [instance-frozen]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${instance-frozen:output} template = ${instance-frozen:output}
...@@ -23,5 +40,7 @@ template = ${template-pull-backup:output} ...@@ -23,5 +40,7 @@ template = ${template-pull-backup:output}
rendered = $${buildout:directory}/template-pull-backup.cfg rendered = $${buildout:directory}/template-pull-backup.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
context = context =
key slave_instance_list slap-configuration:slave-instance-list
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key ipv6 slap-configuration:ipv6-random key ipv6 slap-configuration:ipv6-random
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