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

Merge branch 'master' into erp5-component

parents 7a144a1c 63778a11
Changes
=======
0.58 (Unreleased)
0.59 (Unreleased)
-----------------
0.58 (2012-07-06)
-----------------
* Agent rewrite. [Vincent Pelletier]
0.57 (2012-06-22)
-----------------
......
......@@ -28,13 +28,13 @@ environment =
# NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location}
recipe = plone.recipe.command
stop-on-error = true
commit = 4bde3206ac0dc1e5736cb18a42851e203a6cc68f
commit = ab689c5d3cc29d02d788506c0f1b2ab0742a0f05
repository = https://github.com/ajaxorg/cloud9.git
location = ${buildout:parts-directory}/${:_buildout_section_name_}
git-binary = ${git:location}/bin/git
npm-binary = ${nodejs:location}/bin/node ${nodejs:location}/bin/npm
environment = export GIT_SSL_NO_VERIFY=true; export PATH=${nodejs:location}/bin:$PATH; export LDFLAGS=-L${libxml2:location}/lib;
command = ${:environment} (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit} && ${node-sm:location}/node_modules/.bin/sm install && ${:npm-binary} install) || (rm -fr ${:location}; exit 1)
environment = export GIT_SSL_NO_VERIFY=true; export PATH=${nodejs:location}/bin:${node-sm:location}/node_modules/sm/bin/:$PATH; export LDFLAGS=-L${libxml2:location}/lib; export HOME=${:location};
command = ${:environment} (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit} && ${node-sm:location}/node_modules/.bin/sm install) || (rm -fr ${:location}; exit 1)
update-command =
[cloud9-npm]
......@@ -50,4 +50,4 @@ packages =
cloud9==0.7
# Specify environment jsDAV (dependency of cloud9) needs libxml2
environment =
LDFLAGS=-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib
LDFLAGS=-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib
\ No newline at end of file
......@@ -18,6 +18,7 @@ configure-options =
--openssl-includes=${openssl:location}/include
--openssl-libpath=${openssl:location}/lib
environment =
HOME=${buildout:parts-directory}/${:_buildout_section_name_}
PATH=${pkgconfig:location}/bin:${python2.7:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig/
CPPFLAGS=-I${zlib:location}/include
......@@ -47,4 +48,4 @@ origin = https://github.com/isaacs/npm.git
git-bin = ${git:location}/bin/git
node-bin = ${nodejs-0.4:location}/bin/node
command = (GIT_SSL_NO_VERIFY=true ${:git-bin} clone --quiet ${:origin} ${:location} && cd ${:location} && ${:git-bin} reset --hard ${:commit} && ${:location}/configure --prefix=${:location} && GIT_SSL_NO_VERIFY=true ${:git-bin} submodule update --init --recursive && ${:node-bin} cli.js install npm@1.0.106 -g -f) || (rm -fr ${:location}; exit 1)
update-command =
update-command =
\ No newline at end of file
......@@ -112,47 +112,51 @@ scripts =
slapproxy = slapos.proxy:main
[versions]
zc.buildout = 1.6.0-dev-SlapOS-004
zc.buildout = 1.6.0-dev-SlapOS-006
hexagonit.recipe.download = 1.5.1-dev-slapos-002
# Generated by buildout-versions
Jinja2 = 2.6
Pygments = 1.5
Werkzeug = 0.8.3
buildout-versions = 1.7
collective.recipe.template = 1.9
hexagonit.recipe.cmmi = 1.5.0
docutils = 0.9.1
hexagonit.recipe.cmmi = 1.6
ipython = 0.13
lxml = 2.3.4
meld3 = 0.6.8
netaddr = 0.7.6
slapos.core = 0.25
netaddr = 0.7.7
slapos.core = 0.26.1
slapos.libnetworkcache = 0.12
xml-marshaller = 0.9.7
z3c.recipe.scripts = 1.0.1
zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.25
Flask = 0.8
# slapos.core==0.26.1
Flask = 0.9
# Required by:
# hexagonit.recipe.cmmi==1.5.0
hexagonit.recipe.download = 1.5.0
# netaddr==0.7.7
Sphinx = 1.1.3
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
netifaces = 0.8
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
# slapos.libnetworkcache==0.12
# supervisor==3.0a12
# zc.buildout==1.6.0-dev-SlapOS-004
# zope.interface==3.8.0
# zc.buildout==1.6.0-dev-SlapOS-006
# zope.interface==4.0.1
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
supervisor = 3.0a12
# Required by:
# slapos.core==0.25
zope.interface = 3.8.0
# slapos.core==0.26.1
zope.interface = 4.0.1
......@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
import glob
import os
version = '0.58-dev'
version = '0.59-dev'
name = 'slapos.cookbook'
long_description = open("README.txt").read() + "\n" + \
open("CHANGES.txt").read() + "\n"
......
......@@ -34,76 +34,45 @@ from slapos.recipe.librecipe import GenericSlapRecipe
import json
import ConfigParser
# XXX: BaseSlapRecipe and GenericSlapRecipe are deprecated, use
# GenericBaseRecipe and move partition parameter fetching to software release.
class Recipe(BaseSlapRecipe, GenericSlapRecipe):
def install(self):
self.path_list = []
self.crond = self.installCrond()
crond = self.installCrond()
slap = slapos.slap.slap()
computer_id = self.computer_id
computer_partition_id = self.computer_partition_id
server_url = self.server_url
key_file = self.key_file
cert_file = self.cert_file
slap.initializeConnection(server_url, key_file, cert_file)
self.computer_partition = slap.registerComputerPartition(
computer_id, computer_partition_id)
self.parameter_dict = self.computer_partition.getInstanceParameterDict()
slap.initializeConnection(self.server_url, self.key_file, self.cert_file)
parameter_dict = slap.registerComputerPartition(
self.computer_id,
self.computer_partition_id,
).getInstanceParameterDict()
# XXX: should probably expect one more (SR-originating) parameter instead
# of using self.work_directory .
configuration_path = os.path.join(self.work_directory, "agent.cfg")
configuration = ConfigParser.SafeConfigParser()
configuration.add_section("agent")
configuration.set("agent", "portal_url", self.parameter_dict["portal_url"])
configuration.set("agent", "master_url", self.parameter_dict["master_url"])
configuration.set("agent", "report_url", self.parameter_dict["report_url"])
key_filepath = os.path.join(self.work_directory, "key")
key_file = open(key_filepath, "w")
key_file.write(self.parameter_dict["key"])
key_file.close()
configuration.set("agent", "key_file", key_filepath)
cert_filepath = os.path.join(self.work_directory, "cert")
cert_file = open(cert_filepath, "w")
cert_file.write(self.parameter_dict["cert"])
cert_file.close()
configuration.set("agent", "cert_file", cert_filepath)
configuration.set("agent", "maximum_software_installation_duration",
self.parameter_dict["maximum_software_installation_duration"])
configuration.set("agent", "software_live_duration",
self.parameter_dict["software_live_duration"])
configuration.set("agent", "computer_list",
self.parameter_dict["computer_list"])
configuration.set("agent", "software_list",
self.parameter_dict["software_list"])
configuration.set("agent", "log_directory", self.options["log_directory"])
configuration.set("agent", "state_file", self.options["state_file"])
state = open(self.options["state_file"], "w")
state.write('')
state.close()
configuration.add_section("software_uri")
software_list = json.loads(self.parameter_dict["software_list"])
for software in software_list:
configuration.set("software_uri", software, self.parameter_dict[software])
with open(configuration_path, "w") as configuration:
configuration.write(parameter_dict["configuration"])
agent_crond_path = os.path.join(crond, "agent")
with open(agent_crond_path, "w") as agent_crond:
agent_crond.write("*/5 * * * * %s -S %s --pidfile=%s --log=%s "
"%s 2>&1 > /dev/null\n" % (
self.options["python_binary"],
self.options["agent_binary"],
self.options["pidfile"],
self.options["log"],
configuration_path,
))
configuration.write(open(configuration_path, "w"))
agent_crond_path = os.path.join(self.crond, "agent")
agent_crond = open(agent_crond_path, "w")
agent_crond.write("*/3 * * * * %s -S %s" % \
(self.options["python_binary"],
"%s --pidfile=%s %s" % \
(self.options["agent_binary"], self.options["pidfile"],
configuration_path)))
agent_crond.close()
return self.path_list + [configuration_path, key_filepath, cert_filepath, agent_crond_path]
return self.path_list + [configuration_path, agent_crond_path]
def installCrond(self):
_, self.ws = self.egg.working_set()
_, ws = self.egg.working_set()
timestamps = self.createDataDirectory('cronstamps')
cron_output = os.path.join(self.log_directory, 'cron-output')
self._createDirectory(cron_output)
catcher = zc.buildout.easy_install.scripts([('catchcron',
__name__ + '.catdatefile', 'catdatefile')], self.ws, sys.executable,
__name__ + '.catdatefile', 'catdatefile')], ws, sys.executable,
self.bin_directory, arguments=[cron_output])[0]
self.path_list.append(catcher)
cron_d = os.path.join(self.etc_directory, 'cron.d')
......@@ -111,7 +80,7 @@ class Recipe(BaseSlapRecipe, GenericSlapRecipe):
self._createDirectory(cron_d)
self._createDirectory(crontabs)
wrapper = zc.buildout.easy_install.scripts([('crond',
'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
'slapos.recipe.librecipe.execute', 'execute')], ws, sys.executable,
self.wrapper_directory, arguments=[
self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs,
'-t', timestamps, '-f', '-l', '5', '-M', catcher]
......
[buildout]
parts =
rootdirectory
instance
eggs-directory = ${buildout:eggs-directory}
......@@ -9,17 +8,16 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
agent_binary = ${buildout:directory}/bin/agent
report_start = ${buildout:directory}/bin/report_start
report_stop = ${buildout:directory}/bin/report_stop
dcrond_binary = ${dcron:location}/sbin/crond
python_binary = ${python2.7:location}/bin/python
pidfile = $${buildout:directory}/agent.pid
log_directory = $${buildout:directory}/var/log
state_file = $${buildout:directory}/state.cfg
pidfile = $${rootdirectory:run}/agent.pid
log = $${rootdirectory:agentlog}/agent.log
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
run = $${rootdirectory:etc}/run/
var = $${buildout:directory}/var/
log = $${rootdirectory:var}/log/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
run = $${buildout:directory}/etc/run
agentlog = $${buildout:directory}/var/log/agent
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
[buildout]
# develop =
# /opt/slapdev
# /opt/slapos.toolbox
extends =
../../component/dcron/buildout.cfg
../../component/python-2.7/buildout.cfg
......@@ -31,7 +26,7 @@ eggs = ${instance-recipe:egg}
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
md5sum = 2e1a7a68b18de68b163e98a5f92cc776
md5sum = c7cb98594f394d05baedabe424643f6f
mode = 0644
[eggs]
......@@ -41,6 +36,7 @@ eggs =
${lxml-python:egg}
slapos.cookbook
slapos.toolbox
erp5.util
[lxml-python]
python = python2.7
......@@ -53,7 +49,7 @@ eggs =
${lxml-python:egg}
slapos.core
slapos.cookbook
slapos.toolbox
slapos.toolbox[agent]
[networkcache]
# signature certificates of the following uploaders.
......
......@@ -68,11 +68,11 @@ slapos.cookbook = 0.53
slapos.libnetworkcache = 0.12
slapos.recipe.build = 0.9
slapos.recipe.template = 2.4
slapos.toolbox = 0.24
slapos.toolbox = 0.26
smmap = 0.8.2
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
Flask = 0.8
# Required by:
......@@ -100,7 +100,7 @@ inotifyx = 0.2.0
# Required by:
# slapos.cookbook==0.53
# slapos.core==0.25
# slapos.core==0.26.1
# xml-marshaller==0.9.7
lxml = 2.3.4
......@@ -109,7 +109,7 @@ lxml = 2.3.4
netaddr = 0.7.7
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
netifaces = 0.8
# Required by:
......@@ -122,7 +122,7 @@ psutil = 0.4.1
# Required by:
# slapos.cookbook==0.53
# slapos.core==0.25
# slapos.core==0.26.1
# slapos.libnetworkcache==0.12
# slapos.toolbox==0.24
# supervisor==3.0a12
......@@ -133,10 +133,10 @@ setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.53
slapos.core = 0.25
slapos.core = 0.26.1
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
supervisor = 3.0a12
# Required by:
......@@ -148,5 +148,5 @@ xml-marshaller = 0.9.7
zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.25
# slapos.core==0.26.1
zope.interface = 4.0.1
......@@ -66,7 +66,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-php.cfg
output = ${buildout:directory}/template-apache-php.cfg
md5sum = b5fe314c3437151bb048ada9b37f9318
md5sum = ae9c0f8c70a62f13eb948424c99d71e2
mode = 0644
[template-apache-backup]
......
......@@ -55,7 +55,7 @@ eggs =
[versions]
# Use patched hexagonit.recipe.download from
# https://github.com/SlapOS/hexagonit.recipe.download
hexagonit.recipe.download = 1.5.1-dev-slapos-001
hexagonit.recipe.download = 1.5.1-dev-slapos-002
# Use SlapOS patched zc.buildout
zc.buildout = 1.6.0-dev-SlapOS-006
......
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