Commit 2d05ad6c authored by Antoine Catton's avatar Antoine Catton

Merge branch 'lxc'

Conflicts:
	setup.py
parents a54461cd a7c0ff1e
......@@ -130,7 +130,6 @@ setup(name=name,
'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe',
'stunnel = slapos.recipe.stunnel:Recipe',
'symbolic.link = slapos.recipe.symbolic_link:Recipe',
'template = slapos.recipe.template:Recipe',
'testnode = slapos.recipe.testnode:Recipe',
'tidstorage = slapos.recipe.tidstorage:Recipe',
'urlparse = slapos.recipe._urlparse:Recipe',
......
##############################################################################
#
# 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.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
mapping = self.options.copy()
for key in ('output', 'template', 'recipe', 'mode'):
if key in mapping:
del mapping[key]
with open(self.options['output'], 'w') as output, \
open(self.options['template'], 'r') as template:
output.write(template.read() % mapping)
if 'mode' in self.options:
os.chmod(self.options['output'], int(self.options['mode'], 8))
return [self.options['output'], ]
......@@ -57,14 +57,11 @@ path = ${tar:location}/bin/:${gzip:location}/bin/:${bzip2:location}/bin/:${xz-ut
archive = true
[lxc-conf]
recipe = slapos.cookbook:template
template = ${lxc-conf-in:location}/${lxc-conf-in:filename}
recipe = slapos.recipe.template
url = ${lxc-conf-in:location}/${lxc-conf-in:filename}
output = $${rootdirectory:etc}/lxc.conf
bridge = !!BRIDGE_NAME!!
interface = lxc$${slap-network-information:network-interface}
name = $${uuid:uuid}
rootfs = $${rootfs:downloaded-file}
requested = $${slap-connection:requested}
[passwd]
recipe = slapos.cookbook:pwgen
......
# %(requested)s
# ${slap-connection:requested}
lxc.utsname = %(name)s
lxc.utsname = ${uuid:uuid}
lxc.network.type = veth
lxc.network.link = %(bridge)s
lxc.network.veth.pair = %(interface)s
lxc.network.link = ${:bridge}
lxc.network.veth.pair = ${:interface}
lxc.network.name = eth0
lxc.network.flags = up
......@@ -24,6 +24,6 @@ lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
lxc.cgroup.devices.allow = c 254:0 rwm
lxc.rootfs = %(rootfs)s
lxc.rootfs = ${rootfs:downloaded-file}
lxc.cap.drop = sys_module sys_time sys_chroot mknod
......@@ -36,7 +36,7 @@ mode = 0644
[template-lxc]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-lxc.cfg
md5sum = 27b9c3a9013beda84b336ea603e306bf
md5sum = 056912602caa71a2af9fcae97ee6dfb9
output = ${buildout:directory}/template-lxc.cfg
mode = 0644
......@@ -44,7 +44,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
filename = lxc.conf.in
md5sum = e47acb30a9783d2f264b51b3c46262ae
md5sum = b25334fc369e4e0f608bc64f14b0315d
download-only = true
[slapos-toolbox]
......
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