Commit 9e672906 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Merge branch 'erp5-component' into erp5

parents ae87f77a 0c1d06b5
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
# #
############################################################################## ##############################################################################
from hashlib import sha512 import hashlib
import inspect
import json import json
import os import os
import signal import signal
...@@ -43,33 +42,14 @@ from slapos import slap as slapmodule ...@@ -43,33 +42,14 @@ from slapos import slap as slapmodule
def promise(args): def promise(args):
def failed_ssh(partition, ssh): def failed_ssh():
sys.stderr.write("SSH Connection failed\n") sys.stderr.write("SSH Connection failed\n")
try: partition = slap.registerComputerPartition(args['computer_id'],
ssh.terminate() args['partition_id'])
except:
pass
partition.bang("SSH Connection failed. rdiff-backup is unusable.") partition.bang("SSH Connection failed. rdiff-backup is unusable.")
def sigterm_handler(signum, frame): def sigterm_handler(signum, frame):
# Walk up in the stack to get promise local failed_ssh()
# variables
ssh = None
for upper_frame in inspect.getouterframes(frame):
# Use promise.func_name insteand of 'promise' in order to be
# detected by editor if promise func name change.
# Else, it's hard to debug this kind of error.
if upper_frame[3] == promise.func_name:
try:
partition = upper_frame[0].f_locals['partition']
ssh = upper_frame[0].f_locals['ssh']
except KeyError:
raise SystemExit("SIGTERM Send too soon.")
break
# If ever promise function wasn't found in the stack.
if ssh is None:
raise SystemExit
failed_ssh(partition, ssh)
signal.signal(signal.SIGTERM, sigterm_handler) signal.signal(signal.SIGTERM, sigterm_handler)
...@@ -78,9 +58,6 @@ def promise(args): ...@@ -78,9 +58,6 @@ def promise(args):
key_file=args.get('key_file'), key_file=args.get('key_file'),
cert_file=args.get('cert_file')) cert_file=args.get('cert_file'))
partition = slap.registerComputerPartition(args['computer_id'],
args['partition_id'])
ssh = subprocess.Popen([args['ssh_client'], '%(user)s@%(host)s/%(port)s' % args], ssh = subprocess.Popen([args['ssh_client'], '%(user)s@%(host)s/%(port)s' % args],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=open(os.devnull, 'w'), stdout=open(os.devnull, 'w'),
...@@ -97,7 +74,7 @@ def promise(args): ...@@ -97,7 +74,7 @@ def promise(args):
if ssh.poll() is None: if ssh.poll() is None:
return 1 return 1
if ssh.returncode != 0: if ssh.returncode != 0:
failed_ssh(partition, ssh) failed_ssh()
return ssh.returncode return ssh.returncode
...@@ -108,12 +85,12 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -108,12 +85,12 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
path_list = [] path_list = []
url = entry.get('url') url = entry.get('url')
if url is None: if not url:
url = '' raise ValueError('Missing URL parameter for PBS recipe')
# We assume that thanks to sha512 there's no collisions # We assume that thanks to sha512 there's no collisions
url_hash = sha512(url).hexdigest() url_hash = hashlib.sha512(url).hexdigest()
name_hash = sha512(entry['name']).hexdigest() name_hash = hashlib.sha512(entry['name']).hexdigest()
promise_path = os.path.join(self.options['promises-directory'], promise_path = os.path.join(self.options['promises-directory'],
url_hash) url_hash)
......
...@@ -203,7 +203,7 @@ class RequestOptional(Recipe): ...@@ -203,7 +203,7 @@ class RequestOptional(Recipe):
status = self.instance.getState() status = self.instance.getState()
else: else:
status = 'not ready yet' status = 'not ready yet'
except (slapmodule.NotFoundError, slapmodule.ServerError): except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady):
status = 'not ready yet' status = 'not ready yet'
except AttributeError: except AttributeError:
status = 'unknown' status = 'unknown'
......
...@@ -51,7 +51,7 @@ class Recipe: ...@@ -51,7 +51,7 @@ class Recipe:
if os.path.lexists(link): if os.path.lexists(link):
if not os.path.islink(link): if not os.path.islink(link):
raise zc.buildout.UserError( raise zc.buildout.UserError(
'Target link already %r exists but it is not link' % link) 'Target %r already exists but is not a link' % link)
os.unlink(link) os.unlink(link)
os.symlink(linkline, link) os.symlink(linkline, link)
self.logger.debug('Created link %r -> %r' % (link, linkline)) self.logger.debug('Created link %r -> %r' % (link, linkline))
......
...@@ -35,7 +35,7 @@ git-executable = ${git:location}/bin/git ...@@ -35,7 +35,7 @@ git-executable = ${git:location}/bin/git
[slapos.cookbook-repository] [slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git repository = http://git.erp5.org/repos/slapos.git
branch = lapp-resilient3 branch = master
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
[slapos.core-repository] [slapos.core-repository]
......
...@@ -13,8 +13,31 @@ parts += ...@@ -13,8 +13,31 @@ parts +=
instance instance
instance-apache-php instance-apache-php
slapos-recipe-maarch-egg slapos-recipe-maarch-egg
slapos.cookbook-repository
check-recipe
develop =
${:parts-directory}/slapos.cookbook-repository
extensions = buildout-versions
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
revision = 7dce435eca6fe2eeff60c865d41ee40db59257fa
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
#---------------- #----------------
#-- #--
......
...@@ -290,7 +290,7 @@ extra-context = ...@@ -290,7 +290,7 @@ extra-context =
[template-memcached] [template-memcached]
< = template-jinja2-base < = template-jinja2-base
filename = instance-memcached.cfg filename = instance-memcached.cfg
md5sum = 2de1801236eb78651ecfd50ada46dd3b md5sum = 346c864c1f119360eddb5e163f16d4f3
extra-context = extra-context =
key dash_location dash:location key dash_location dash:location
key dcron_location dcron:location key dcron_location dcron:location
...@@ -645,7 +645,7 @@ inotifyx = 0.2.0 ...@@ -645,7 +645,7 @@ inotifyx = 0.2.0
ipdb = 0.7 ipdb = 0.7
ipython = 0.13.1 ipython = 0.13.1
meld3 = 0.6.10 meld3 = 0.6.10
mr.developer = 1.24 mr.developer = 1.25
netaddr = 0.7.10 netaddr = 0.7.10
netifaces = 0.8 netifaces = 0.8
ordereddict = 1.1 ordereddict = 1.1
...@@ -658,7 +658,7 @@ pyPdf = 1.13 ...@@ -658,7 +658,7 @@ pyPdf = 1.13
pyflakes = 0.6.1 pyflakes = 0.6.1
python-ldap = 2.4.10 python-ldap = 2.4.10
python-magic = 0.4.3 python-magic = 0.4.3
qrcode = 2.4.2 qrcode = 2.5.1
requests = 1.1.0 requests = 1.1.0
restkit = 4.2.1 restkit = 4.2.1
rtjp-eventlet = 0.3.2 rtjp-eventlet = 0.3.2
......
...@@ -27,9 +27,9 @@ recipe = slapos.cookbook:generic.kumofs ...@@ -27,9 +27,9 @@ recipe = slapos.cookbook:generic.kumofs
# Network options # Network options
ip = ${slap-network-information:local-ipv4} ip = ${slap-network-information:local-ipv4}
manager-port = 13101 manager-port = 13401
server-port = 13201 server-port = 13501
server-listen-port = 13202 server-listen-port = 13502
# previous memcached configuration # previous memcached configuration
gateway-port = 11000 gateway-port = 11000
# previous memcached configuration # previous memcached configuration
......
...@@ -311,100 +311,115 @@ signature-certificate-list = ...@@ -311,100 +311,115 @@ signature-certificate-list =
[versions] [versions]
Jinja2 = 2.6 Jinja2 = 2.6
Werkzeug = 0.8.3 Werkzeug = 0.8.3
apache-libcloud = 0.11.4 apache-libcloud = 0.12.1
async = 0.6.1 async = 0.6.1
buildout-versions = 1.7 buildout-versions = 1.7
cp.recipe.cmd = 0.4
gitdb = 0.5.4 gitdb = 0.5.4
hexagonit.recipe.cmmi = 1.6 hexagonit.recipe.cmmi = 1.6
inotifyx = 0.2.0
lxml = 3.0.2
meld3 = 0.6.10 meld3 = 0.6.10
netaddr = 0.7.10 plone.recipe.command = 1.1
psycopg2 = 2.4.6
pycrypto = 2.6 pycrypto = 2.6
pytz = 2012h
rdiff-backup = 1.0.5 rdiff-backup = 1.0.5
slapos.cookbook = 0.72.0 slapos.recipe.build = 0.11.6
slapos.recipe.download = 1.0.dev-r4053 slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.4.2 slapos.recipe.template = 2.4.2
slapos.toolbox = 0.33.1
smmap = 0.8.2 smmap = 0.8.2
# Required by: # Required by:
# slapos.core==0.33.2-dev # slapos.core==0.35.1
# slapos.toolbox==0.32.1-dev # slapos.toolbox==0.33.1
Flask = 0.9 Flask = 0.9
# Required by: # Required by:
# slapos.toolbox==0.32.1-dev # slapos.toolbox==0.33.1
GitPython = 0.3.2.RC1 GitPython = 0.3.2.RC1
# Required by: # Required by:
# slapos.toolbox==0.32.1-dev # slapos.toolbox==0.33.1
atomize = 0.1.1 atomize = 0.1.1
# Required by: # Required by:
# slapos.toolbox==0.32.1-dev # slapos.toolbox==0.33.1
feedparser = 5.1.3 feedparser = 5.1.3
# Required by: # Required by:
# hexagonit.recipe.cmmi==1.6 # slapos.cookbook==0.74.1-dev
hexagonit.recipe.download = 1.6nxd002 inotifyx = 0.2.0
# Required by: # Required by:
# slapos.core==0.33.2-dev # slapos.cookbook==0.74.1-dev
# slapos.core==0.35.1
# xml-marshaller==0.9.7
lxml = 3.1.0
# Required by:
# slapos.cookbook==0.74.1-dev
netaddr = 0.7.10
# Required by:
# slapos.core==0.35.1
netifaces = 0.8 netifaces = 0.8
# Required by: # Required by:
# slapos.toolbox==0.32.1-dev # slapos.toolbox==0.33.1
paramiko = 1.9.0 paramiko = 1.10.0
# Required by: # Required by:
# slapos.toolbox==0.32.1-dev # slapos.toolbox==0.33.1
psutil = 0.6.1 psutil = 0.6.1
# Required by: # Required by:
# slapos.core==0.33.2-dev # slapos.recipe.maarch==0.4
pyflakes = 0.5.0 psycopg2 = 2.4.6
# Required by: # Required by:
# slapos.cookbook==0.70.1-dev # slapos.core==0.35.1
# slapos.core==0.33.2-dev pyflakes = 0.6.1
# slapos.toolbox==0.32.1-dev
# Required by:
# slapos.cookbook==0.74.1-dev
pytz = 2013b
# Required by:
# slapos.cookbook==0.74.1-dev
# slapos.core==0.35.1
# slapos.recipe.maarch==0.4
# slapos.toolbox==0.33.1
# supervisor==3.0b1 # supervisor==3.0b1
# zc.buildout==1.6.0-dev-SlapOS-010 # zc.buildout==1.6.0-dev-SlapOS-010
# zope.interface==4.0.2 # zope.interface==4.0.5
setuptools = 0.6c12dev-r88846 setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.core==0.33.2-dev # slapos.cookbook==0.74.1-dev
supervisor = 3.0b1 # slapos.toolbox==0.33.1
slapos.core = 0.35.1
# Required by: # Required by:
# slapos.toolbox==0.32.1-dev # slapos.core==0.35.1
xml-marshaller = 0.9.7 supervisor = 3.0b1
# Required by: # Required by:
# slapos.core==0.33.2-dev # slapos.core==0.35.1
zope.interface = 4.0.2 unittest2 = 0.5.1
cp.recipe.cmd = 0.4
plone.recipe.command = 1.1
slapos.recipe.build = 0.11.5
slapos.toolbox = 0.33
# Required by: # Required by:
# slapos.toolbox==0.33 # slapos.cookbook==0.74.1-dev
slapos.core = 0.35 # slapos.toolbox==0.33.1
xml-marshaller = 0.9.7
# Required by: # Required by:
# slapos.core==0.35 # zope.testing==4.1.2
unittest2 = 0.5.1 zope.exceptions = 4.0.6
# Required by: # Required by:
# zope.testing==4.1.1 # slapos.core==0.35.1
zope.exceptions = 4.0.5 # zope.testing==4.1.2
zope.interface = 4.0.5
# Required by: # Required by:
# cp.recipe.cmd==0.4 # cp.recipe.cmd==0.4
zope.testing = 4.1.1 zope.testing = 4.1.2
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