Commit fdcfeaab authored by Vivien Alger's avatar Vivien Alger

Moving to a configuration wrapper rather than a recipe

parent 0c611277
...@@ -131,7 +131,6 @@ setup(name=name, ...@@ -131,7 +131,6 @@ setup(name=name,
'kumofs = slapos.recipe.kumofs:Recipe', 'kumofs = slapos.recipe.kumofs:Recipe',
'kvm = slapos.recipe.kvm:Recipe', 'kvm = slapos.recipe.kvm:Recipe',
'kvm.frontend = slapos.recipe.kvm_frontend:Recipe', 'kvm.frontend = slapos.recipe.kvm_frontend:Recipe',
'kvm.monitor = slapos.recipe.kvm_monitor:MonitorRecipe',
'lamp = slapos.recipe.lamp:Request', 'lamp = slapos.recipe.lamp:Request',
'lamp.generic = slapos.recipe.lampgeneric:Recipe', 'lamp.generic = slapos.recipe.lampgeneric:Recipe',
'lamp.request = slapos.recipe.lamp:Request', 'lamp.request = slapos.recipe.lamp:Request',
......
##############################################################################
#
# 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.
#
##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
class MonitorRecipe(GenericBaseRecipe):
def install(self):
options = self.options
config = dict(
kvm_monitor_path=options['kvm-monitor-path'],
filepath = options['filepath'],
xml_path = options['xml-path'],
sections = options['sections'],
options = options['options']
)
script = self.createExecutable(
options['path'],
self.substituteTemplate(
self.getTemplateFilename('kvm_monitor_run.in'),config
)
)
return [script]
#!/bin/sh
exec %(kvm_monitor_path)s %(filepath)s %(xml_path)s -s %(sections)s -opts %(options)s
...@@ -71,7 +71,7 @@ command = ...@@ -71,7 +71,7 @@ command =
[template-kvm] [template-kvm]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg.in url = ${:_profile_base_location_}/instance-kvm.cfg.in
md5sum = 06a4dc42f84914b3ec6694ad857f9d27 md5sum = cb8adfb70882a07e1df3943983c27963
output = ${buildout:directory}/template-kvm.cfg output = ${buildout:directory}/template-kvm.cfg
mode = 0644 mode = 0644
......
...@@ -130,13 +130,14 @@ port = $${novnc-instance:port} ...@@ -130,13 +130,14 @@ port = $${novnc-instance:port}
[kvm-monitor] [kvm-monitor]
recipe = slapos.cookbook:kvm.monitor recipe = slapos.cookbook:wrapper
path = $${directory:services}/kvm_monitor wrapper-path = $${directory:services}/kvm_monitor
kvm-monitor-path = ${buildout:bin-directory}/kvm.monitor.test command-line = ${buildout:bin-directory}/kvm.monitor.test
filepath = $${buildout:directory}/buildout-switch-softwaretype.cfg $${buildout:directory}/buildout-switch-softwaretype.cfg
sections = slap-parameter $${buildout:directory}/report.xml
options = disk-size ram-size cpu-count -s slap-parameter
xml-path = $${buildout:directory}/report.xml -opts disk-size ram-size cpu-count
#---------------- #----------------
...@@ -163,7 +164,7 @@ log = $${directory:log}/crond.log ...@@ -163,7 +164,7 @@ log = $${directory:log}/crond.log
recipe = slapos.cookbook:cron.d recipe = slapos.cookbook:cron.d
name = kvm_monitor name = kvm_monitor
frequency = 0 0 * * * frequency = 0 0 * * *
command = $${kvm-monitor:path} command = $${kvm-monitor:wrapper-path}
[request-slave-frontend] [request-slave-frontend]
recipe = slapos.cookbook:requestoptional recipe = slapos.cookbook:requestoptional
......
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