Commit a78cda7f 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 205bb266
...@@ -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:
......
...@@ -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 = 942cfb82b9cd129faf2a31e598fa3362
[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 = 99e1444f2978717ce0427767fb078945
[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}
......
...@@ -23,5 +23,6 @@ template = ${template-pull-backup:output} ...@@ -23,5 +23,6 @@ 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