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

recipe/pbs: slave-instance-list is already a list of JSON

See !739
parent 5afb8605
Pipeline #9103 failed with stage
...@@ -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:
......
...@@ -82,7 +82,7 @@ class PBSTest(unittest.TestCase): ...@@ -82,7 +82,7 @@ class PBSTest(unittest.TestCase):
'run-directory': run_directory, 'run-directory': run_directory,
'cron-entries': cron_directory, 'cron-entries': cron_directory,
'known-hosts': 'TEST_KNOWN_HOSTS', 'known-hosts': 'TEST_KNOWN_HOSTS',
'slave-instance-list': '''[ 'slave-instance-list': [
{ {
"url": "http://url.to.pull/", "url": "http://url.to.pull/",
"type": "pull", "type": "pull",
...@@ -101,7 +101,6 @@ class PBSTest(unittest.TestCase): ...@@ -101,7 +101,6 @@ class PBSTest(unittest.TestCase):
"frequency": "TEST_FREQUENCY" "frequency": "TEST_FREQUENCY"
} }
] ]
'''
}) })
recipe._install() recipe._install()
......
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