From 1736de2eda8d67b2f24fed115766a3d9da27d912 Mon Sep 17 00:00:00 2001 From: Brad Crittenden Date: Wed, 11 Dec 2013 11:53:29 -0400 Subject: Updated to use proper config variable. Added logging. --- config.yaml | 2 +- hooks/hooks.py | 1 + tests/test_write_log_rotate_config.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index c147d71..5f24593 100644 --- a/config.yaml +++ b/config.yaml @@ -15,7 +15,7 @@ options: default: daily type: string description: How often should the logs be rotated. Use values from logrotate. - logrotate-keep: + logrotate-rotate: default: 5 type: int description: Number of log files to keep. diff --git a/hooks/hooks.py b/hooks/hooks.py index 6e24dc6..9e737f6 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -1433,6 +1433,7 @@ def config_changed_volume_apply(): def write_logrotate_config(config_data, conf_file = '/etc/logrotate.d/mongodb-server'): + juju_log('Writing {}.'.format(conf_file)) contents = dedent(""" {logpath} {{ {logrotate-frequency} diff --git a/tests/test_write_log_rotate_config.py b/tests/test_write_log_rotate_config.py index 58c0fb3..c6ea054 100644 --- a/tests/test_write_log_rotate_config.py +++ b/tests/test_write_log_rotate_config.py @@ -22,7 +22,7 @@ class TestWriteLogrotateConfigFile(unittest.TestCase): mock_open.return_value = mock.MagicMock(spec=file) hooks.write_logrotate_config(config_data, temp_fn) os.unlink(temp_fn) - self.assertFalse(mock_juju_log.called) + mock_juju_log.assert_called_once_with('Writing {}.'.format(temp_fn)) mock_open.assert_called_once_with(temp_fn, 'w') mock_file = mock_open().__enter__() call_args = mock_file.write.call_args[0][0] -- cgit v1.2.3