From 4d67c5a478d523e858c7804905164fb6333c9fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Thu, 5 May 2011 13:43:54 +0200 Subject: [PATCH] Do nothing in case if log rotation is not enabled. --- slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py b/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py index fdb752564c..5d54ad2a4b 100644 --- a/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py +++ b/slapos/recipe/erp5/src/slapos/recipe/erp5/__init__.py @@ -146,11 +146,15 @@ class Recipe(BaseSlapRecipe): def registerLogRotation(self, name, log_file_list, postrotate_script): """Register new log rotation requirement""" - open(os.path.join(self.logrotate_d, name), 'w').write( + if getattr(self, 'logrotate_d', None) is not None: + open(os.path.join(self.logrotate_d, name), 'w').write( self.substituteTemplate(self.getTemplateFilename( 'logrotate_entry.in'), dict(file_list=' '.join(['"'+q+'"' for q in log_file_list]), postrotate=postrotate_script, olddir=self.logrotate_backup))) + else: + self.logger.warning('No log rotation configured for %r, as log rotate ' + 'is not configured' % name) def linkBinary(self): """Links binaries to instance's bin directory for easier exposal""" -- 2.30.9