Commit 08f2b352 authored by Łukasz Nowak's avatar Łukasz Nowak

Merge branch 'erp5-generic' of http://git.erp5.org/repos/slapos into erp5-generic

parents 4d6144f4 c0d260d6
......@@ -58,13 +58,10 @@ class Recipe(GenericBaseRecipe):
class Part(GenericBaseRecipe):
def _options(self, options):
if 'name' not in options:
options['name'] = self.name
def install(self):
cron_d = self.options['cron-entries']
filename = os.path.join(cron_d, 'name')
name = self.options['name']
filename = os.path.join(cron_d, name)
with open(filename, 'w') as part:
part.write('%(frequency)s %(command)s\n' % {
......
......@@ -30,39 +30,28 @@ from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def _options(self, options):
if 'name' not in options:
options['name'] = self.name
def install(self):
path_list = []
logrotate_backup = self.options['backup']
logrotate_d = self.options['logrotate-entries']
logrotate_conf_file = self.options['conf']
logrotate_conf = []
logrotate_conf.append("include %s" % logrotate_d)
logrotate_conf.append("olddir %s" % logrotate_backup)
logrotate_conf.append("dateext")
frequency = 'daily'
if 'frequency' in self.options:
frequency = self.options['frequency']
logrotate_conf.append(frequency)
num_rotate = 3650
if 'num-rotate' in self.options:
num_rotate = self.options['num-rotate']
logrotate_conf.append("rotate %s" % num_rotate)
logrotate_conf.append("compress")
logrotate_conf.append("compresscmd %s" % self.options['gzip-binary'])
logrotate_conf.append("compressoptions -9")
logrotate_conf.append("uncompresscmd %s" % self.options['gunzip-binary'])
logrotate_conf_file = self.createFile(logrotate_conf_file, '\n'.join(logrotate_conf))
logrotate_conf.append(logrotate_conf_file)
logrotate_conf = [
'daily',
'dateext',
'rotate 3650',
'compress',
'compresscmd %s' % self.options['gzip-binary'],
'compressoptions -9',
'uncompresscmd %s' % self.options['gunzip-binary'],
'notifempty',
'sharedscripts',
'create',
'include %s' % logrotate_d,
'olddir %s' % logrotate_backup,
]
logrotate_conf_file = self.createFile(logrotate_conf_file,
'\n'.join(logrotate_conf))
state_file = self.options['state-file']
......@@ -71,46 +60,25 @@ class Recipe(GenericBaseRecipe):
'slapos.recipe.librecipe.exceute.execute',
[self.options['logrotate-binary'], '-s', state_file, logrotate_conf_file, ]
)
path_list.append(logrotate)
return path_list
return [logrotate, logrotate_conf_file]
class Part(GenericBaseRecipe):
def _options(self, options):
if 'name' not in options:
options['name'] = self.name
def install(self):
logrotate_d = self.options['logrotate-entries']
part_path = os.path.join(logrotate_d, self.options['name'])
conf = []
if 'frequency' in self.options:
conf.append(self.options['frequency'])
if 'num-rotate' in self.options:
conf.append('rotate %s' % self.options['num-rotate'])
if 'post' in self.options:
conf.append("postrotate\n%s\nendscript" % self.options['post'])
if 'pre' in self.options:
conf.append("prerotate\n%s\nendscript" % self.options['pre'])
if self.optionIsTrue('sharedscripts', False):
conf.append("sharedscripts")
if self.optionIsTrue('notifempty', False):
conf.append('notifempty')
if self.optionIsTrue('create', True):
conf.append('create')
log = self.options['log']
self.createFile(os.path.join(logrotate_d, self.options['name']),
part_path = self.createFile(os.path.join(logrotate_d, self.options['name']),
"%(logfiles)s {\n%(conf)s\n}" % {
'logfiles': log,
'conf': '\n'.join(conf),
......
......@@ -46,14 +46,9 @@ kumo-server-binary = ${kumo:location}/bin/kumo-server
[logrotate-entry-kumofs]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = mariadb
name = kumofs
log = $${kumofs-instance:kumo-gateway-log} $${kumofs-instance:kumo-manager-log}
$${kumofs-instance:kumo-server-log}
frequency = daily
rotate-num = 30
sharedscripts = true
notifempty = true
create = true
# rest of parts are candidates for some generic stuff
......
......@@ -89,12 +89,7 @@ state-file = $${rootdirectory:srv}/logrotate.status
recipe = slapos.cookbook:logrotate.d
name = mariadb
log = $${mariadb-instance:error-log} $${mariadb-instance:slow-query-log}
frequency = daily
rotate-num = 30
post = $${mariadb-instance:mysql-binary} --no-defaults -B --socket=$${mariadb-instance:socket} -e "FLUSH LOGS"
sharedscripts = true
notifempty = true
create = true
[cron]
recipe = slapos.cookbook:cron
......
......@@ -25,7 +25,7 @@ wrapper = $${basedirectory:services}/apache-%(backend_name)s
[logrotate-entry-apache-%(backend_name)s]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = zope
name = apache-%(backend_name)s
log = $${apache-%(backend_name)s:error-log} $${apache-%(backend_name)s:access-log}
post = ${buildout:bin-directory}/killpidfromfile $${apache-%(backend_name)s:pid-file} SIGUSR1
......
......@@ -100,11 +100,6 @@ conf = $${rootdirectory:etc}/logrotate.conf
logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup}
state-file = $${rootdirectory:srv}/logrotate.status
frequency = daily
rotate-num = 3650
sharedscripts = true
notifempty = true
create = true
[zeo-instance-entry-common]
recipe = slapos.cookbook:zeo
......
......@@ -23,7 +23,7 @@ unzip = true
[template-mariadb]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb.cfg
md5sum = 9c8517900877ce43af64ef6db28fc520
md5sum = 02bac3aec28226f4e7c2398bd454e8a8
output = ${buildout:directory}/template-mariadb.cfg
mode = 0644
......@@ -44,7 +44,7 @@ mode = 0644
[template-kumofs]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kumofs.cfg
md5sum = d8a4a1976f4d22fae0668be0543438cc
md5sum = 9ba8a7f8eb67c51979b38602bb6610b8
output = ${buildout:directory}/template-kumofs.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