Merge ~gschiano/squid-reverseproxy-charm:fix-binary-path-issue into squid-reverseproxy-charm:master

Proposed by Grégory Schiano
Status: Merged
Approved by: Haw Loeung
Approved revision: 9434258773639b52c13547a1498ce255cfe17cbf
Merged at revision: 78b2ec226e39b664e2781b5f93212c9d1ae15846
Proposed branch: ~gschiano/squid-reverseproxy-charm:fix-binary-path-issue
Merge into: squid-reverseproxy-charm:master
Diff against target: 69 lines (+15/-15)
1 file modified
hooks/hooks.py (+15/-15)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Canonical IS Reviewers Pending
Review via email: mp+460275@code.launchpad.net

Commit message

Fix issue with squid binary on 22.04

Description of the change

On 22.04 the binary is /usr/sbin/squid while the charm didn't customize it based on charm host version

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
Haw Loeung (hloeung) wrote :

LGTM

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

Change successfully merged at revision 78b2ec226e39b664e2781b5f93212c9d1ae15846

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/hooks/hooks.py b/hooks/hooks.py
2index 87fa850..3aad58c 100755
3--- a/hooks/hooks.py
4+++ b/hooks/hooks.py
5@@ -1,34 +1,33 @@
6 #!/usr/bin/env python3
7
8+import collections
9 import math
10 import os
11 import random
12 import re
13 import shutil
14+import socket
15 import string
16 import subprocess
17 import sys
18-import yaml
19-import collections
20-import socket
21-import apt_pkg
22
23+import apt_pkg
24+import yaml
25+from charmhelpers.contrib.charmsupport.nrpe import NRPE
26+from charmhelpers.core import host
27+from charmhelpers.core.hookenv import close_port
28+from charmhelpers.core.hookenv import config as config_get
29 from charmhelpers.core.hookenv import (
30- config as config_get,
31 is_relation_made,
32+ local_unit,
33 log,
34- relation_set,
35- relation_get,
36- relation_ids as get_relation_ids,
37- relations_of_type,
38- related_units,
39 open_port,
40- close_port,
41- local_unit,
42+ related_units,
43+ relation_get,
44 )
45+from charmhelpers.core.hookenv import relation_ids as get_relation_ids
46+from charmhelpers.core.hookenv import relation_set, relations_of_type
47 from charmhelpers.fetch import apt_install
48-from charmhelpers.contrib.charmsupport.nrpe import NRPE
49-from charmhelpers.core import host
50
51 ###############################################################################
52 # Global variables
53@@ -45,6 +44,7 @@ default_squid3_config = "%s/squid.conf" % default_squid3_config_dir
54 default_squid3_config_cache_dir = "/var/run/{}".format(squid_name)
55 default_squid3_cache_dir = "/var/spool/{}".format(squid_name)
56 default_nagios_plugin_dir = "/usr/lib/nagios/plugins"
57+default_squid3_binary = "/usr/sbin/{}".format(squid_name)
58 access_log_path = "/var/log/{}/access.log".format(squid_name)
59 metrics_cronjob_path = "/etc/cron.d/squid_metrics"
60 metrics_script_path = "/usr/local/bin/squid_metrics.py"
61@@ -455,7 +455,7 @@ def service_squid3(action=None, squid3_config=default_squid3_config):
62 if action is None or squid3_config is None:
63 return
64 elif action == "check":
65- check_cmd = ['/usr/sbin/squid3', '-f', squid3_config, '-k', 'parse']
66+ check_cmd = [default_squid3_binary, '-f', squid3_config, '-k', 'parse']
67 return not subprocess.call(check_cmd)
68 elif action in ('start', 'stop', 'reload', 'restart', 'status'):
69 return host.service(action, service_name)

Subscribers

People subscribed via source and target branches

to all changes: