From 224c7d980b4aeb30e7d8ecc4d17a0f78c12c1339 Mon Sep 17 00:00:00 2001 From: Marco Mariani <marco.mariani@nexedi.com> Date: Fri, 16 Nov 2012 16:54:44 +0100 Subject: [PATCH] add option to enable/disable bully --- slapos/recipe/addresiliency/__init__.py | 10 +++++++--- stack/resilient/buildout.cfg | 2 +- stack/resilient/pbsready.cfg.in | 16 +++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/slapos/recipe/addresiliency/__init__.py b/slapos/recipe/addresiliency/__init__.py index 0a0b5abe9..2a377355f 100644 --- a/slapos/recipe/addresiliency/__init__.py +++ b/slapos/recipe/addresiliency/__init__.py @@ -37,7 +37,7 @@ class Recipe(GenericSlapRecipe): def _install(self): path_list = [] - confpath = os.path.join(self.options['script'], 'bully.conf') + confpath = os.path.join(self.options['etc'], 'bully.conf') ip_list = self.parameter_dict['ip-list'] print 'Creating bully configuration with ips : %s\n' % ip_list @@ -54,9 +54,13 @@ class Recipe(GenericSlapRecipe): slap_connection = self.buildout['slap-connection'] - # XXX use the bin directory, do not run automatically yet + if self.optionIsTrue('enable-bully-service', default=False): + wrapper_dir = self.options['services'] + else: + wrapper_dir = self.options['bin'] + wrapper = self.createPythonScript( - name=os.path.join(self.options['bin'], self.parameter_dict['wrapper']), + name=os.path.join(wrapper_dir, self.parameter_dict['wrapper']), absolute_function='slapos.recipe.addresiliency.bully.run', arguments={ 'confpath': confpath, diff --git a/stack/resilient/buildout.cfg b/stack/resilient/buildout.cfg index ac7e95c8c..7c0d9a2aa 100644 --- a/stack/resilient/buildout.cfg +++ b/stack/resilient/buildout.cfg @@ -22,7 +22,7 @@ parts = recipe = slapos.recipe.template url = ${:_profile_base_location_}/pbsready.cfg.in output = ${buildout:directory}/pbsready.cfg -md5sum = 0e6a383849840419ce767325f5a368a4 +md5sum = b6102416d000cae81dd2b06268946ea9 mode = 0644 [pbsready-import] diff --git a/stack/resilient/pbsready.cfg.in b/stack/resilient/pbsready.cfg.in index 93e232a89..305419873 100644 --- a/stack/resilient/pbsready.cfg.in +++ b/stack/resilient/pbsready.cfg.in @@ -24,7 +24,6 @@ parts = #-- Creation of all needed directories. [basedirectory] -script = $${rootdirectory:etc}/script services = $${rootdirectory:etc}/run cache = $${rootdirectory:var}/cache notifier = $${rootdirectory:etc}/notifier @@ -35,26 +34,25 @@ ssh = $${rootdirectory:etc}/ssh/ sshkeys = $${rootdirectory:srv}/sshkeys notifier-feeds = $${basedirectory:notifier}/feeds notifier-callbacks = $${basedirectory:notifier}/callbacks -script = $${basedirectory:script} #---------------- #-- -#-- resiliency script for the bully algorithm +#-- Resiliency script for the bully algorithm [resiliency] -# XXX The bully script is not run automatically, at the moment. -# For testing, run bin/bully for all the PBSReady instances. -# To enable automatic running, change the recipe and create the wrapper under "script" instead of "bin" +# If enable-bully-service is true, the scripts will be run automatically. +# If false, they can be run with bin/bullly for all the PBSReady instances. +enable-bully-service = False recipe = slapos.cookbook:addresiliency -script = $${basedirectory:script} -run = $${basedirectory:services} +services = $${basedirectory:services} bin = $${rootdirectory:bin} +etc = $${rootdirectory:etc} #---------------- #-- -#-- sets up an rdiff-backup server (with a dropbear server for ssh) +#-- Sets up an rdiff-backup server (with a dropbear server for ssh) [urls] ssh-public-key = $${sshkeys-dropbear:public-key-value} -- 2.30.9