Commit 2836a9b0 authored by Guillaume Hervier's avatar Guillaume Hervier

stack/logrotate: auto-restart services on SR upgrade.

parent e15a7686
...@@ -70,8 +70,9 @@ class ServicesTestCase(InstanceTestCase): ...@@ -70,8 +70,9 @@ class ServicesTestCase(InstanceTestCase):
hash_files = [ hash_files = [
'software_release/buildout.cfg', 'software_release/buildout.cfg',
] ]
service_names = [ expected_process_names = [
'monitor-httpd', 'monitor-httpd-{hash}-on-watch',
'crond-{hash}',
] ]
supervisor = self.getSupervisorRPCServer().supervisor supervisor = self.getSupervisorRPCServer().supervisor
...@@ -81,8 +82,8 @@ class ServicesTestCase(InstanceTestCase): ...@@ -81,8 +82,8 @@ class ServicesTestCase(InstanceTestCase):
hash_files = [os.path.join(self.computer_partition_root_path, path) hash_files = [os.path.join(self.computer_partition_root_path, path)
for path in hash_files] for path in hash_files]
for service_name in service_names: for name in expected_process_names:
h = ServicesTestCase.generateHashFromFiles(hash_files) h = ServicesTestCase.generateHashFromFiles(hash_files)
expected_process_name = '{}-{}-on-watch'.format(service_name, h) expected_process_name = name.format(hash=h)
self.assertIn(expected_process_name, process_names) self.assertIn(expected_process_name, process_names)
...@@ -22,4 +22,4 @@ md5sum = 117e46af6d9d31c09eeb86089d11407e ...@@ -22,4 +22,4 @@ md5sum = 117e46af6d9d31c09eeb86089d11407e
[template-logrotate-base] [template-logrotate-base]
filename = instance-logrotate-base.cfg.in filename = instance-logrotate-base.cfg.in
md5sum = 9f44fc5ee22c6662297b41f71fa11b7c md5sum = f56b86a0742afff931a5e972114566e4
[buildout] [buildout]
parts = parts =
cron-service
cron-entry-logrotate cron-entry-logrotate
logrotate-entry-cron logrotate-entry-cron
...@@ -10,7 +11,16 @@ dcrond-binary = {{ dcron_location }}/sbin/crond ...@@ -10,7 +11,16 @@ dcrond-binary = {{ dcron_location }}/sbin/crond
crontabs = ${logrotate-directory:crontabs} crontabs = ${logrotate-directory:crontabs}
cronstamps = ${logrotate-directory:cronstamps} cronstamps = ${logrotate-directory:cronstamps}
catcher = ${cron-simplelogger:wrapper} catcher = ${cron-simplelogger:wrapper}
binary = ${logrotate-directory:services}/crond binary = ${logrotate-directory:bin}/crond
# This is here so to keep backward compatibility where the cron
# section should create the service too and keep variables here
service = ${cron-service:wrapper-path}
[cron-service]
recipe = slapos.cookbook:wrapper
command-line = ${cron:binary}
wrapper-path = ${logrotate-directory:services}/crond
hash-files = ${buildout:directory}/software_release/buildout.cfg
[cron-simplelogger] [cron-simplelogger]
recipe = slapos.cookbook:simplelogger recipe = slapos.cookbook:simplelogger
...@@ -51,7 +61,7 @@ post = ...@@ -51,7 +61,7 @@ post =
pre = pre =
frequency = daily frequency = daily
rotate-num = 3650 rotate-num = 3650
nocompress = nocompress =
[logrotate] [logrotate]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
......
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