Commit 71b35322 authored by Titouan Soulard's avatar Titouan Soulard

cookbook: allow using new api for recipes

parent 464bbbdb
......@@ -54,6 +54,7 @@ class GenericjIOAPIRecipe(GenericBaseRecipe):
self.computer_id = slap_connection['computer-id']
self.computer_partition_id = slap_connection['partition-id']
self.server_url = slap_connection['server-url']
self.slapgrid_jio_uri = slap_connection['slapgrid-jio-uri']
self.software_release_url = slap_connection['software-release-url']
self.key_file = slap_connection.get('key-file')
self.cert_file = slap_connection.get('cert-file')
......@@ -72,8 +73,9 @@ class GenericjIOAPIRecipe(GenericBaseRecipe):
with open(self.instance_json_path, "r") as f:
self.computer_partition = json.load(f)
self.slap.initializeConnection(self.server_url, self.key_file,
self.cert_file)
self.slap.initializeConnection(self.server_url,
key_file=self.key_file, cert_file=self.cert_file,
slapgrid_jio_uri=self.slapgrid_jio_uri)
# Fallback to requesting to SlapOS Master
if not self.computer_partition:
......
......@@ -127,7 +127,10 @@ class Recipe(object):
# By default, propagate the state of the parent instance
# Except if parent is destroyed, as it may lead to the unexpected
# destruction of the full instance tree
default_state = buildout['slap-connection'].get('requested', 'started')
slap_connection = buildout['slap-connection']
default_state = slap_connection.get('requested', 'started')
slapgrid_jio_uri = slap_connection.get('slapgrid-jio-uri', None)
if default_state not in ('started', 'stopped'):
default_state = 'started'
requested_state = options.get('state', default_state)
......@@ -136,8 +139,9 @@ class Recipe(object):
slap = slapmodule.slap()
slap.initializeConnection(
options['server-url'],
options.get('key-file'),
options.get('cert-file'),
key_file=options.get('key-file'),
cert_file=options.get('cert-file'),
slapgrid_jio_uri=slapgrid_jio_uri,
)
if not slap.jio_api_connector:
request = slap.registerComputerPartition(
......
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