Merge lp:~vern/charm-haproxy/fix-install-hook into lp:charm-haproxy

Proposed by Vern Hart
Status: Merged
Approved by: Tom Haddon
Approved revision: 148
Merged at revision: 148
Proposed branch: lp:~vern/charm-haproxy/fix-install-hook
Merge into: lp:charm-haproxy
Diff against target: 36 lines (+7/-17)
1 file modified
hooks/install (+7/-17)
To merge this branch: bzr merge lp:~vern/charm-haproxy/fix-install-hook
Reviewer Review Type Date Requested Status
Tom Haddon Approve
Paul Collins lgtm Approve
Review via email: mp+410140@code.launchpad.net

Commit message

Simplify install hook (works on bionic and focal).

Fixes: https://bugs.launchpad.net/charm-haproxy/+bug/1946798

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
Paul Collins (pjdc) :
review: Approve (lgtm)
Revision history for this message
Vern Hart (vern) wrote :

Note that I tested this on bionic and focal by deploying with --series:

  juju deploy ../../charms/haproxy haproxyb --bind oam-space --series bionic --to lxd:0
  juju deploy ../../charms/haproxy haproxyf --bind oam-space --series focal --to lxd:0

And verifying that the charms installed correctly.

Revision history for this message
Tom Haddon (mthaddon) wrote :

This is a nice simplification. Thanks.

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

Change successfully merged at revision 148

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/install'
2--- hooks/install 2021-10-13 14:16:58 +0000
3+++ hooks/install 2021-10-13 15:17:05 +0000
4@@ -2,25 +2,15 @@
5
6 set -eu
7
8-apt_get_install() {
9- DEBIAN_FRONTEND=noninteractive apt-get -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $@
10-}
11-
12 apt-get -y update
13
14 juju-log 'Invoking charm-pre-install hooks'
15 [ -d exec.d ] && ( for f in exec.d/*/charm-pre-install; do [ -x $f ] && /bin/sh -c "$f"; done )
16
17-if dpkg --compare-versions "$(lsb_release -rs)" ge 20.04; then
18- # Install missing python-yaml and python-apt packages
19- apt-get install -y python2 python-yaml python-apt
20-
21- juju-log 'Invoking python-based install hook'
22- python2 hooks/hooks.py install
23-else
24- # Install missing python-yaml and python-apt packages
25- apt-get install -y python-yaml python-apt
26-
27- juju-log 'Invoking python-based install hook'
28- python hooks/hooks.py install
29-fi
30+# Install missing python-yaml and python-apt packages
31+# Note that these depend on python2 on focal and newer
32+apt-get install -y python-yaml python-apt
33+
34+juju-log 'Invoking python-based install hook'
35+# use python2 because python is 3 on focal or newer
36+python2 hooks/hooks.py install

Subscribers

People subscribed via source and target branches

to all changes: