Merge ~hloeung/content-cache-charm:nginx-config into content-cache-charm:master

Proposed by Haw Loeung
Status: Merged
Approved by: Barry Price
Approved revision: d48bda3ff45fe3f5c1b1be6b32cf5447bb2c3c46
Merged at revision: 30e643cd476ed52403ca3d42f3d32f81342b136a
Proposed branch: ~hloeung/content-cache-charm:nginx-config
Merge into: content-cache-charm:master
Diff against target: 37 lines (+6/-2)
2 files modified
lib/nginx.py (+6/-1)
tests/unit/files/nginx_config_rendered_test_output-site3.local.txt (+0/-1)
Reviewer Review Type Date Requested Status
Barry Price Approve
Canonical IS Reviewers Pending
Review via email: mp+382979@code.launchpad.net

Commit message

Fixed invalid config in Nginx - proxy_cache_maxconn

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 30e643cd476ed52403ca3d42f3d32f81342b136a

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/nginx.py b/lib/nginx.py
2index e05f727..ff58d60 100644
3--- a/lib/nginx.py
4+++ b/lib/nginx.py
5@@ -94,7 +94,7 @@ class NginxConf:
6 def _generate_keys_zone(self, name):
7 return '{}-cache'.format(hashlib.md5(name.encode('UTF-8')).hexdigest()[0:12])
8
9- def _process_locations(self, locations):
10+ def _process_locations(self, locations): # NOQA: C901
11 conf = {}
12 for location, loc_conf in locations.items():
13 conf[location] = deepcopy(loc_conf)
14@@ -118,6 +118,11 @@ class NginxConf:
15 elif 'cache-valid' in lc:
16 cache_val = lc['cache-valid']
17
18+ # No such thing as proxy_cache_maxconn, this is more used by
19+ # HAProxy so remove/ignore here.
20+ if 'cache-maxconn' in lc:
21+ lc.pop('cache-maxconn')
22+
23 lc['cache-valid'] = []
24 # Support multiple cache-validities per LP:1873116.
25 if isinstance(cache_val, str):
26diff --git a/tests/unit/files/nginx_config_rendered_test_output-site3.local.txt b/tests/unit/files/nginx_config_rendered_test_output-site3.local.txt
27index fba7847..2a1b852 100644
28--- a/tests/unit/files/nginx_config_rendered_test_output-site3.local.txt
29+++ b/tests/unit/files/nginx_config_rendered_test_output-site3.local.txt
30@@ -15,7 +15,6 @@ server {
31 proxy_cache d515cd6e60b1-cache;
32 proxy_cache_background_update on;
33 proxy_cache_lock on;
34- proxy_cache_maxconn 4096;
35 proxy_cache_min_uses 1;
36 proxy_cache_revalidate on;
37 proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;

Subscribers

People subscribed via source and target branches