Merge lp:~woutervb/charms/trusty/logstash-forwarder/bionic-support into lp:~canonical-is-sa/charms/trusty/logstash-forwarder/trunk

Proposed by Wouter van Bommel
Status: Merged
Approved by: Haw Loeung
Approved revision: 25
Merged at revision: 25
Proposed branch: lp:~woutervb/charms/trusty/logstash-forwarder/bionic-support
Merge into: lp:~canonical-is-sa/charms/trusty/logstash-forwarder/trunk
Diff against target: 47 lines (+20/-0)
2 files modified
hooks/hooks.py (+19/-0)
metadata.yaml (+1/-0)
To merge this branch: bzr merge lp:~woutervb/charms/trusty/logstash-forwarder/bionic-support
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Review via email: mp+402683@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2019-08-22 13:09:17 +0000
3+++ hooks/hooks.py 2021-05-13 02:21:01 +0000
4@@ -47,12 +47,31 @@
5 apt_update()
6 apt_install(conf.packageName(), options=['--force-yes'])
7
8+def lsb_release():
9+ """Return /etc/lsb-release in a dict"""
10+ d = {}
11+ with open('/etc/lsb-release', 'r') as lsb:
12+ for l in lsb:
13+ k, v = l.split('=')
14+ d[k.strip()] = v.strip()
15+ return d
16+
17+
18+def get_distrib_codename():
19+ """Return the codename of the distribution
20+ :returns: The codename
21+ :rtype: str
22+ """
23+ return lsb_release()['DISTRIB_CODENAME'].lower()
24+
25
26 def replaceInitScript():
27 src = os.path.join(charm_dir(), "files", "init.sh")
28 dest = "/etc/init.d/logstash-forwarder"
29 shutil.copyfile(src, dest)
30 os.chmod(dest, 0755)
31+ if get_distrib_codename() == 'bionic':
32+ subprocess.call(['systemctl', 'daemon-reload'])
33
34
35 def writeEtcDefault():
36
37=== modified file 'metadata.yaml'
38--- metadata.yaml 2017-03-06 12:49:07 +0000
39+++ metadata.yaml 2021-05-13 02:21:01 +0000
40@@ -10,6 +10,7 @@
41 series:
42 - trusty
43 - xenial
44+ - bionic
45 provides:
46 nrpe-external-master:
47 interface: nrpe-external-master

Subscribers

People subscribed via source and target branches