Commit bcd47114 authored by Romain Courteaud's avatar Romain Courteaud

Generate symbolic links needed by innobackup

parent 5740bd29
......@@ -76,6 +76,7 @@ setup(name=name,
'proactive = slapos.recipe.proactive:Recipe',
'request = slapos.recipe.request:Recipe',
'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed',
'symbolic.link = slapos.recipe.symbolic_link:Recipe',
'softwaretype = slapos.recipe.softwaretype:Recipe',
'siptester = slapos.recipe.siptester:SipTesterRecipe',
'simplelogger = slapos.recipe.simplelogger:Recipe',
......
##############################################################################
#
# 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.
#
##############################################################################
import os
import logging
class Recipe:
def __init__(self, buildout, name, options):
self.buildout = buildout
self.name = name
self.options = options
self.logger = logging.getLogger(self.name)
def install(self):
"""
Links binaries to instance's bin directory for easier exposal
"""
path_list = []
target_directory = self.options['target-directory']
for linkline in self.options['link-binary'].split():
path, linkname = os.path.split(linkline)
link = os.path.join(target_directory, linkname)
if os.path.lexists(link):
if not os.path.islink(link):
raise zc.buildout.UserError(
'Target link already %r exists but it is not link' % link)
os.unlink(link)
os.symlink(linkline, link)
self.logger.debug('Created link %r -> %r' % (link, linkline))
path_list.append(link)
return path_list
......@@ -7,6 +7,7 @@ parts =
cron
cron-entry-logrotate
cron-entry-mariadb-backup
binary-link
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
......@@ -119,6 +120,19 @@ name = mariadb-backup
frequency = 0 0 * * *
command = $${mariadb-instance:backup-script}
[binary-link]
recipe = slapos.cookbook:symbolic.link
target-directory = $${rootdirectory:bin}
link-binary =
${coreutils:location}/bin/basename
${coreutils:location}/bin/cat
${coreutils:location}/bin/cp
${coreutils:location}/bin/ls
${coreutils:location}/bin/tr
${coreutils:location}/bin/uname
${grep:location}/bin/grep
${sed:location}/bin/sed
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
......
......@@ -23,7 +23,7 @@ unzip = true
[template-mariadb]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb.cfg
md5sum = 02bac3aec28226f4e7c2398bd454e8a8
md5sum = a0b2cb56d0fe7ad125b7e9fbc6036e1b
output = ${buildout:directory}/template-mariadb.cfg
mode = 0644
......
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