Correctly launches accords platform

parent fcb8c6f5
...@@ -30,7 +30,7 @@ from subprocess import Popen ...@@ -30,7 +30,7 @@ from subprocess import Popen
import sys import sys
class Recipe(GenericSlapRecipe): class Recipe(GenericSlapRecipe):
def install(self): def _install(self):
path_list = [] path_list = []
poc_location = self.buildout['pocdirectory']['poc'] poc_location = self.buildout['pocdirectory']['poc']
...@@ -73,8 +73,13 @@ class Recipe(GenericSlapRecipe): ...@@ -73,8 +73,13 @@ class Recipe(GenericSlapRecipe):
poc_location=poc_location, poc_location=poc_location,
manifest_name=self.options['manifest-name'], manifest_name=self.options['manifest-name'],
# XXX this is workaround # XXX this is workaround
accords_lib_directory=self.options['accords_lib_directory']) accords_lib_directory=self.options['accords_lib_directory'],
computer_id = self.computer_id,
computer_partition_id = self.computer_partition_id,
server_url = self.server_url,
software_release_url = self.software_release_url,
key_file = self.key_file,
cert_file = self.cert_file,)
wrapper_location = self.createPythonScript(self.options['accords-wrapper'], wrapper_location = self.createPythonScript(self.options['accords-wrapper'],
'%s.accords.runAccords' % __name__, '%s.accords.runAccords' % __name__,
wrapper_config_dict) wrapper_config_dict)
......
...@@ -29,15 +29,22 @@ ...@@ -29,15 +29,22 @@
from slapos import slap from slapos import slap
import signal import signal
from subprocess import Popen from subprocess import Popen
import sys
import time import time
def runAccords(args): def runAccords(accords_conf):
"""Launch ACCORDS, parse manifest, broker manifest, send connection """Launch ACCORDS, parse manifest, broker manifest, send connection
informations to SlapOS Master. Destroy instance and stops ACCORDS at informations to SlapOS Master. Destroy instance and stops ACCORDS at
SIGTERM.""" SIGTERM."""
computer_id, computer_partition_id, server_url, software_release_url, \ computer_id = accords_conf['computer_id']
key_file, cert_file, \ computer_partition_id = accords_conf['computer_partition_id']
accords_lib_directory, poc_location, manifest_name = args server_url = accords_conf['server_url']
software_release_url = accords_conf['software_release_url']
key_file = accords_conf['key_file']
cert_file = accords_conf['cert_file']
accords_lib_directory = accords_conf['accords_lib_directory']
poc_location = accords_conf['poc_location']
manifest_name = accords_conf['manifest_name']
environment = dict( environment = dict(
LD_LIBRARY_PATH=accords_lib_directory, LD_LIBRARY_PATH=accords_lib_directory,
...@@ -49,25 +56,30 @@ def runAccords(args): ...@@ -49,25 +56,30 @@ def runAccords(args):
cwd=poc_location, env=environment).communicate() cwd=poc_location, env=environment).communicate()
Popen(['./co-stop'], Popen(['./co-stop'],
cwd=poc_location, env=environment).communicate() cwd=poc_location, env=environment).communicate()
sys.exit(0)
signal.signal(signal.SIGTERM, sigtermHandler) signal.signal(signal.SIGTERM, sigtermHandler)
# Launch ACCORDS, parse & broke manifest to deploy instance # Launch ACCORDS, parse & broke manifest to deploy instance
Popen(['./co-start'],cwd=poc_location, env=environment).communicate() Popen(['./co-start'],cwd=poc_location, env=environment).communicate()
print 'Parsing manifest...'
Popen(['./co-parser', manifest_name], Popen(['./co-parser', manifest_name],
cwd=poc_location, env=environment).communicate() cwd=poc_location, env=environment).communicate()
print 'Brokering manifest...'
Popen(['./co-broker', manifest_name], Popen(['./co-broker', manifest_name],
cwd=poc_location, env=environment).communicate() cwd=poc_location, env=environment).communicate()
print 'Done.'
# Parse answer # Parse answer
# XXX # XXX
connection_dict = dict(connection='hardcoded')
# Send information about published service to SlapOS Master # Send information about published service to SlapOS Master
slap_connection = slap.slap() slap_connection = slap.slap()
slap_connection.initializeConnection(server_url, key_file, cert_file) slap_connection.initializeConnection(server_url, key_file, cert_file)
computer_partition = slap_connection.registerComputerPartition(computer_id, computer_partition = slap_connection.registerComputerPartition(computer_id,
computer_partition_id) computer_partition_id)
computer_partition.setConnectionDict() computer_partition.setConnectionDict(connection_dict)
# Go to sleep, wait kill # Go to sleep, wait kill
while(True): while(True):
......
...@@ -28,7 +28,7 @@ listen-ip = $${slap-network-information:local-ipv4} ...@@ -28,7 +28,7 @@ listen-ip = $${slap-network-information:local-ipv4}
accords-configuration-file = $${pocdirectory:poc}/accords.ini accords-configuration-file = $${pocdirectory:poc}/accords.ini
manifest-source = ${occi-manifest:target} manifest-source = ${occi-manifest:target}
manifest-destination = $${pocdirectory:poc}/manifest.xml manifest-destination = $${pocdirectory:poc}/manifest.xml
manifest-name = $${pocdirectory:poc}/manifest manifest-name = manifest
accords-wrapper = $${basedirectory:services}/accords accords-wrapper = $${basedirectory:services}/accords
# Workaround # Workaround
accords_lib_directory : ${accords:location}/lib accords_lib_directory : ${accords:location}/lib
......
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