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