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