Commit 77db41ff authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge remote-tracking branch 'origin/accords'

Conflicts:
	component/automake/buildout.cfg
	component/ca-certificates/buildout.cfg
	setup.py
parents 47abcaae 93c88cb0
[buildout]
extends =
../autoconf/buildout.cfg
../automake/buildout.cfg
../libtool/buildout.cfg
../git/buildout.cfg
../openssl/buildout.cfg
../libuuid/buildout.cfg
parts = accords
[accords-source]
recipe = slapos.recipe.build:gitclone
repository = http://git.gitorious.ow2.org/ow2-compatibleone/accords-platform.git
[accords]
# Part of Compatible One project
# http://gitorious.ow2.org/ow2-compatibleone/accords-platform
recipe = hexagonit.recipe.cmmi
#url = http://gitorious.ow2.org/ow2-compatibleone/accords-platform/archive-tarball/master
path = ${accords-source:location}/
#md5sum =
# Replaces autogen.sh
configure-command =
./clean
libtoolize -c -f
aclocal -I ${libtool:location}/share/aclocal
automake -c -a -f --add-missing
autoreconf --install
./configure
configure-options =
--with-ssl=${openssl:location}
--prefix=${buildout:parts-directory}/${:_buildout_section_name_}
environment =
CPPFLAGS =-I${libuuid:location}/include -I${openssl:location}/include
LDFLAGS =-Wl,-rpath=${openssl:location}/lib -L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib
LIBTOOL=libtool
PATH=${autoconf:location}/bin:${automake:location}/bin:${libtool:location}/bin:%(PATH)s
# Accords makefile does not install necessary scripts. Let's copy it
[accords-scripts]
recipe = plone.recipe.command
requires = ${accords:location}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
origin = ${accords-source:location}/scripts
destination = ${:location}
command = ([ -e ${:origin}/co-broker ] && [ ! -e ${:destination}/co-broker ] && mkdir ${:destination} && cp -r ${:origin} ${:destination})
......@@ -69,6 +69,7 @@ setup(name=name,
entry_points={
'zc.buildout': [
'addresiliency = slapos.recipe.addresiliency:Recipe',
'accords = slapos.recipe.accords:Recipe',
'agent = slapos.recipe.agent:Recipe',
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe',
'apacheperl = slapos.recipe.apacheperl:Recipe',
......@@ -90,6 +91,7 @@ setup(name=name,
'condor = slapos.recipe.condor:Recipe',
'condor.submit = slapos.recipe.condor:AppSubmit',
'configurationfile = slapos.recipe.configurationfile:Recipe',
'copyfilelist = slapos.recipe.copyfilelist:Recipe',
'cron = slapos.recipe.dcron:Recipe',
'cron.d = slapos.recipe.dcron:Part',
'davstorage = slapos.recipe.davstorage:Recipe',
......
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import shutil
from slapos.recipe.librecipe import GenericSlapRecipe
import shutil
import subprocess
import sys
class Recipe(GenericSlapRecipe):
def _install(self):
path_list = []
accords_location = self.buildout['accordsdirectory']['accords']
parameter_dict = dict(
userid=self.options['userid'],
tenantname=self.options['tenantname'],
password=self.options['password'],
domain=self.options['domain'],
openstack_url=self.options['openstack_url'],
python_location=sys.executable,
accords_location=accords_location,
manifest_name=self.options['manifest-name'],
# XXX this is workaround
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,
path = '%s:%s' % (self.options['accords_bin_directory'],
os.environ.get('PATH', '')),
)
# Generate os-config.xml
os_config_file = self.createFile(self.options['os-config'],
self.substituteTemplate(self.getTemplateFilename('os_config.xml.in'),
parameter_dict))
path_list.append(os_config_file)
# Put modified accords configuration file
accords_configuration_parameter_dict = dict(
listen_ip = self.options['listen-ip']
)
accords_configuration_file_location = self.createFile(
self.options['accords-configuration-file'],
self.substituteTemplate(self.getTemplateFilename('accords.ini.in'),
accords_configuration_parameter_dict))
path_list.append(accords_configuration_file_location)
# XXX is it dangerous?
security_path = os.path.join(accords_location, 'security')
if os.path.exists(security_path):
shutil.rmtree(security_path)
# Initiate configuration
subprocess.check_call('./accords-config',
cwd=accords_location
)
# Generate manifest
manifest_origin_location = self.options['manifest-source']
manifest_location = self.options['manifest-destination']
shutil.copy(manifest_origin_location, manifest_location)
path_list.append(manifest_location)
# Generate wrapper
wrapper_location = self.createPythonScript(self.options['accords-wrapper'],
'%s.accords.runAccords' % __name__,
parameter_dict)
path_list.append(wrapper_location)
# Generate helper for debug
self.createExecutable(
self.options['testos-wrapper'],
self.substituteTemplate(self.getTemplateFilename('testos.in'),
parameter_dict)
)
return path_list
#!%(python_location)s
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
from slapos import slap
import signal
import subprocess
from subprocess import Popen
import sys
import time
def runAccords(accords_conf):
"""Launch ACCORDS, parse manifest, broker manifest, send connection
informations to SlapOS Master. Destroy instance and stops ACCORDS at
SIGTERM."""
computer_id = accords_conf['computer_id']
computer_partition_id = accords_conf['computer_partition_id']
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']
accords_location = accords_conf['accords_location']
manifest_name = accords_conf['manifest_name']
environment = dict(
LD_LIBRARY_PATH=accords_lib_directory,
PATH=accords_conf['path'],
HOME=accords_location,
)
# Set handler to stop ACCORDS when end of world comes
# XXX use subprocess.check_call and add exception handlers
def sigtermHandler(signum, frame):
Popen(['./co-command', 'stop', '/service/*'],
cwd=accords_location, env=environment).communicate()
Popen(['./co-stop'],
cwd=accords_location, env=environment).communicate()
sys.exit(0)
signal.signal(signal.SIGTERM, sigtermHandler)
# Launch ACCORDS, parse & broke manifest to deploy instance
print 'Starting ACCORDS and friends...'
subprocess.check_call(['./co-start'],cwd=accords_location, env=environment)
print 'Parsing manifest...'
subprocess.check_call(['./co-parser', manifest_name],
cwd=accords_location, env=environment)
print 'Brokering manifest...'
subprocess.check_call(['./co-broker', manifest_name],
cwd=accords_location, env=environment)
print 'Done.'
# Parse answer
# XXX
connection_dict = dict(connection='hardcoded')
# Send information about published service to SlapOS Master
slap_connection = slap.slap()
slap_connection.initializeConnection(server_url, key_file, cert_file)
computer_partition = slap_connection.registerComputerPartition(computer_id,
computer_partition_id)
computer_partition.setConnectionDict(connection_dict)
# Go to sleep, wait kill
while(True):
time.sleep(60)
# REST host (default: 127.0.0.1)
resthost=%(listen_ip)s
# REST port (default: 8086)
#restport=8086
# Target (default: ./accords.xml)
#target=accords.xml
# Acitvate TLS (default: 0)
#tls=0
# Activate monitoring (default: 1)
#monitor=1
# Trace (default: 1)
#trace=1
# Threads (default:1)
#threads=1
# Be verbose (default: 1)
#verbose=0
# Debug (default: 1)
#debug=1
# Domain (default: occi)
#domain=occi
# Operator (default: accords)
#operator=accords
# Password (default: co-system)
#password=co-system
\ No newline at end of file
<?xml version="1.0" encoding="UTF8"?>
<manifest name="coips:model" xmlns="http://www.compatibleone.fr/schemes/cords.xsd">
<description>Infrastructure profile used by production tool</description>
<node name="coips:model">
<infrastructure name="coips:model">
<compute name="coips:model" cores="1" speed="1GHz" architecture="x686" memory="1GB"/>
<storage name="coips:model" size="10GB" type="SATA"/>
<network name="coips:model" vlan="true" label="database"/>
</infrastructure>
</node>
</manifest>
\ No newline at end of file
<os_configs>
<os_config
id="e1f892e3-slap-slap-slap-9354b95d3b17"
name="slaposrecipe"
description="Configuration of Account used by slapos recipe"
user="%(userid)s"
password="%(password)s"
authenticate=""
agent="CompatibleOne/OpenStackClient/1.0a.0.01"
host="%(openstack_url)s"
version="v1.1"
namespace="%(domain)s"
base=""
tls="0"
current="0"
/>
</os_configs>
\ No newline at end of file
#!/bin/sh
export PATH=%(path)s
export ENO_HOST=%(openstack_url)s
export ENO_USER=%(userid)s
export ENO_PASS=%(password)s
export ENO_VERSION=v1.1
export ENO_TENANT=%(tenantname)s
testos --host $ENO_HOST --password $ENO_PASS --user $ENO_USER --version $ENO_VERSION --tenant $ENO_TENANT $1 $2 $3 $4 $5 $6 $7
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import logging
import shutil
class Recipe:
def __init__(self, buildout, name, options):
self.buildout = buildout
self.name = name
self.options = options
self.logger = logging.getLogger(self.name)
def install(self):
"""
Copy files to selected directory.
"""
path_list = []
target_directory = self.options['target-directory']
for original_file_location in self.options['file-list'].split():
path, name = os.path.split(original_file_location)
destination_file_location = os.path.join(target_directory, name)
if os.path.exists(destination_file_location):
os.remove(destination_file_location)
shutil.copy(original_file_location, destination_file_location)
self.logger.debug('Created copy %r -> %r' % (
original_file_location,
destination_file_location))
path_list.append(destination_file_location)
return path_list
[buildout]
extends =
../../stack/accords/buildout.cfg
parts =
instance
instance-accords
accords
eggs
accords-manifest
[accords-manifest]
# Manifest for xwiki
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/xwiki.manifest.xml
#md5sum = 3e1ea477d48080e9bdb98579f7f28be6
<?xml version="1.0" encoding="UTF8"?>
<manifest name="test2" xmlns="http://www.compatibleone.fr/schemes/cords.xsd">
<description>test 1 : open stack small compute</description>
<node name="test2" type="simple" access="public" scope="normal" provider="openstack" >
<infrastructure name="test2">
<compute name="test2" architecture="x86" cores="1" memory="1G" speed="1G"/>
<storage name="test2" size="10G"/>
<network name="test2" label="ethernet" vlan="100M"/>
</infrastructure>
<image name="test2">
<system name="debian_with_cosacs"/>
<package
name="test2"
installation="mkdir /home/cosacs/vifib"
configuration="cp /home/cosacs/cosacs.xml /home/cosacs/vifib"
/>
</image>
</node>
<configuration name="test2">
<action name="test2_1" expression="test2.x='1';"/>
<action name="test2_2" expression="test2.y='2';"/>
<action name="test2_3" expression="test2.z='3';"/>
</configuration>
<interface name="test2"/>
<account name="slaposrecipe"/>
<security name="test2"/>
</manifest>
\ No newline at end of file
[buildout]
extends =
../../component/accords/buildout.cfg
../../component/lxml-python/buildout.cfg
../slapos.cfg
parts =
instance
instance-accords
accords
eggs
[eggs]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
slapos.cookbook
# If we use only one software type in the future, delete duplication of template
[instance]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = 3e1ea477d48080e9bdb98579f7f28be6
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-accords]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-accords.cfg
#md5sum = 737a6d2f1ea9938b8d76e2d35e18e482
output = ${buildout:directory}/template-accords.cfg
mode = 0644
[networkcache]
# Cedric de Saint Martin signature certificate
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT
MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB
D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1
P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O
BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp
cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr
b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE-----
[buildout]
parts =
copy-scripts
accords-instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
#[url]
#recipe = slapos.cookbook:publishurl
#url =
[accords-instance]
recipe = slapos.cookbook:accords
# Options
userid = cedric.de
domain = domain
tenantname = vifib
#userid = $${slap-parameter:userid}
password = $${slap-parameter:password}
#domain = $${slap-parameter:domain}
#tenantname = $${slap-parameter:tenantname}
openstack_url = http://beta.enocloud.com:5000/v2.0/
os-config = $${accordsdirectory:accords}/os_config.xml
listen-ip = $${slap-network-information:local-ipv4}
# Paths
accords-configuration-file = $${accordsdirectory:accords}/accords.ini
manifest-source = ${accords-manifest:target}
manifest-destination = $${accordsdirectory:accords}/manifest.xml
manifest-name = manifest
accords-wrapper = $${basedirectory:services}/accords
testos-wrapper = $${rootdirectory:bin}/testos
# Workaround
accords_lib_directory : ${accords:location}/lib
accords_bin_directory : ${accords:location}/bin
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
[accordsdirectory]
recipe = slapos.cookbook:mkdirectory
accords = $${rootdirectory:srv}/accords
rest = $${accordsdirectory:accords}/rest
service = $${accordsdirectory:accords}/service
security = $${accordsdirectory:accords}/security
[copy-scripts]
recipe = slapos.cookbook:copyfilelist
target-directory = $${accordsdirectory:accords}
file-list =
${accords-scripts:location}/scripts/accords
${accords-scripts:location}/scripts/accords-config
${accords-scripts:location}/scripts/co-broker
${accords-scripts:location}/scripts/co-check
${accords-scripts:location}/scripts/co-command
${accords-scripts:location}/scripts/co-parser
${accords-scripts:location}/scripts/co-platform
${accords-scripts:location}/scripts/co-provider
${accords-scripts:location}/scripts/co-provision
${accords-scripts:location}/scripts/co-resolver
${accords-scripts:location}/scripts/co-start
${accords-scripts:location}/scripts/co-status
${accords-scripts:location}/scripts/co-stop
${accords-scripts:location}/scripts/run-azprocci
${accords-scripts:location}/scripts/run-broker
${accords-scripts:location}/scripts/run-coees
${accords-scripts:location}/scripts/run-coips
${accords-scripts:location}/scripts/run-comons
${accords-scripts:location}/scripts/run-conagios
${accords-scripts:location}/scripts/run-conets
${accords-scripts:location}/scripts/run-coobas
${accords-scripts:location}/scripts/run-cool
${accords-scripts:location}/scripts/run-copaas
${accords-scripts:location}/scripts/run-cops
${accords-scripts:location}/scripts/run-cosacs
${accords-scripts:location}/scripts/run-cosched
${accords-scripts:location}/scripts/run-coss
${accords-scripts:location}/scripts/run-dcprocci
${accords-scripts:location}/scripts/run-ezvm
${accords-scripts:location}/scripts/run-fileserver
${accords-scripts:location}/scripts/run-jpaasprocci
${accords-scripts:location}/scripts/run-onprocci
${accords-scripts:location}/scripts/run-osocciprocci
${accords-scripts:location}/scripts/run-osprocci
${accords-scripts:location}/scripts/run-paasprocci
${accords-scripts:location}/scripts/run-paprocci
${accords-scripts:location}/scripts/run-parser
${accords-scripts:location}/scripts/run-procci
${accords-scripts:location}/scripts/run-publisher
${accords-scripts:location}/scripts/openssl.cnf
${accords-scripts:location}/scripts/run-slam
[buildout]
parts =
switch-softwaretype
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${instance-accords:output}
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