Merge ~hloeung/apt-stresstest-charm:master into apt-stresstest-charm:master

Proposed by Haw Loeung
Status: Merged
Approved by: Barry Price
Approved revision: 1636c4df2c7675b1102eefd3324336f182b51b97
Merged at revision: fb396a4699c3ac6a6cf54b185859dad5ed6e7f81
Proposed branch: ~hloeung/apt-stresstest-charm:master
Merge into: apt-stresstest-charm:master
Diff against target: 48 lines (+14/-3)
2 files modified
files/logrotate.conf (+8/-0)
reactive/apt_stresstest.py (+6/-3)
Reviewer Review Type Date Requested Status
Barry Price Approve
Canonical IS Reviewers Pending
Review via email: mp+392443@code.launchpad.net

Commit message

Add rotating of logs

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Barry Price (barryprice) wrote :

+1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision fb396a4699c3ac6a6cf54b185859dad5ed6e7f81

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/files/logrotate.conf b/files/logrotate.conf
2new file mode 100644
3index 0000000..7d08670
4--- /dev/null
5+++ b/files/logrotate.conf
6@@ -0,0 +1,8 @@
7+/var/log/apt-stresstest.log {
8+ daily
9+ missingok
10+ rotate 90
11+ compress
12+ delaycompress
13+ notifempty
14+}
15diff --git a/reactive/apt_stresstest.py b/reactive/apt_stresstest.py
16index 6b9e416..4adeb73 100644
17--- a/reactive/apt_stresstest.py
18+++ b/reactive/apt_stresstest.py
19@@ -39,8 +39,6 @@ LOGFILE = '/var/log/apt-stresstest.log'
20
21 MIRROR_CONFIG_PATH = "/etc/apt-stresstest-mirrors.yaml"
22
23-IMAGES_CACHE_PATH = "/var/cache/apt-stresstest/images"
24-
25
26 def stress_test_args():
27 config = hookenv.config()
28@@ -85,6 +83,11 @@ def install_crontab():
29 )
30
31
32+def install_logrotate():
33+ charm_dir = hookenv.charm_dir()
34+ shutil.copy(os.path.join(charm_dir, 'files/logrotate.conf'), '/etc/logrotate.d/apt-stresstest')
35+
36+
37 @when_not('apt-stresstest.host_file')
38 def provision_stresstest_mirror_config():
39 config = hookenv.config()
40@@ -134,7 +137,7 @@ def install_apt_stresstest(exec_relation):
41
42 install_script()
43 install_crontab()
44- os.makedirs(IMAGES_CACHE_PATH, exist_ok=True)
45+ install_logrotate()
46
47 with open(LOGFILE, 'a'):
48 os.utime(LOGFILE, None)

Subscribers

People subscribed via source and target branches