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):
hash_files = [
'software_release/buildout.cfg',
]
service_names = [
'monitor-httpd',
expected_process_names = [
'monitor-httpd-{hash}-on-watch',
'crond-{hash}',
]
supervisor = self.getSupervisorRPCServer().supervisor
......@@ -81,8 +82,8 @@ class ServicesTestCase(InstanceTestCase):
hash_files = [os.path.join(self.computer_partition_root_path, path)
for path in hash_files]
for service_name in service_names:
for name in expected_process_names:
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)
......@@ -22,4 +22,4 @@ md5sum = 117e46af6d9d31c09eeb86089d11407e
[template-logrotate-base]
filename = instance-logrotate-base.cfg.in
md5sum = 9f44fc5ee22c6662297b41f71fa11b7c
md5sum = f56b86a0742afff931a5e972114566e4
[buildout]
parts =
cron-service
cron-entry-logrotate
logrotate-entry-cron
......@@ -10,7 +11,16 @@ dcrond-binary = {{ dcron_location }}/sbin/crond
crontabs = ${logrotate-directory:crontabs}
cronstamps = ${logrotate-directory:cronstamps}
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]
recipe = slapos.cookbook:simplelogger
......@@ -51,7 +61,7 @@ post =
pre =
frequency = daily
rotate-num = 3650
nocompress =
nocompress =
[logrotate]
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