Merge ~ines-almeida/txpkgupload:add-logrotate-to-charm into txpkgupload:master

Proposed by Ines Almeida
Status: Merged
Approved by: Ines Almeida
Approved revision: bd27ec4d9213eba876c60f08333dc979ade37e5d
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ines-almeida/txpkgupload:add-logrotate-to-charm
Merge into: txpkgupload:master
Diff against target: 50 lines (+26/-0)
2 files modified
charm/txpkgupload/reactive/txpkgupload.py (+11/-0)
charm/txpkgupload/templates/logrotate.conf.j2 (+15/-0)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Simone Pelosi Approve
Review via email: mp+449426@code.launchpad.net

Commit message

Add logrotate to txpkgupload charm

This is based on the logrotate files in ppa.lp.internal in production

To post a comment you must log in.
Revision history for this message
Simone Pelosi (pelpsi) wrote :

LGTM!

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/charm/txpkgupload/reactive/txpkgupload.py b/charm/txpkgupload/reactive/txpkgupload.py
index 2ec1e90..a8a5b66 100644
--- a/charm/txpkgupload/reactive/txpkgupload.py
+++ b/charm/txpkgupload/reactive/txpkgupload.py
@@ -19,6 +19,16 @@ from charms.reactive import (
19from ols import base19from ols import base
2020
2121
22def configure_logrotate(config):
23 hookenv.log("Writing logrotate configuration.")
24 templating.render(
25 "logrotate.conf.j2",
26 "/etc/logrotate.d/txpkgupload",
27 config,
28 perms=0o644,
29 )
30
31
22def create_virtualenv(wheels_dir, codedir, python_exe):32def create_virtualenv(wheels_dir, codedir, python_exe):
23 hookenv.log("Creating virtualenv for txpkgupload charm")33 hookenv.log("Creating virtualenv for txpkgupload charm")
24 subprocess.check_call(34 subprocess.check_call(
@@ -131,6 +141,7 @@ def configure_txpkgupload(config: Dict):
131 "/lib/systemd/system/txpkgupload.socket",141 "/lib/systemd/system/txpkgupload.socket",
132 config142 config
133 )143 )
144 configure_logrotate(config)
134145
135 hookenv.log("Starting txpkgupload")146 hookenv.log("Starting txpkgupload")
136 subprocess.check_call(["systemctl", "daemon-reload"])147 subprocess.check_call(["systemctl", "daemon-reload"])
diff --git a/charm/txpkgupload/templates/logrotate.conf.j2 b/charm/txpkgupload/templates/logrotate.conf.j2
137new file mode 100644148new file mode 100644
index 0000000..9d82965
--- /dev/null
+++ b/charm/txpkgupload/templates/logrotate.conf.j2
@@ -0,0 +1,15 @@
1{{ logs_dir }}/*.log
2{
3 rotate 90
4 daily
5 dateext
6 delaycompress
7 compress
8 notifempty
9 missingok
10 create 0664 txpkgupload txpkgupload
11 sharedscripts
12 postrotate
13 systemctl reload txpkgupload.service
14 endscript
15}

Subscribers

People subscribed via source and target branches

to all changes: