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