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
diff --git a/lib/nginx.py b/lib/nginx.py
index e05f727..ff58d60 100644
--- a/lib/nginx.py
+++ b/lib/nginx.py
@@ -94,7 +94,7 @@ class NginxConf:
94 def _generate_keys_zone(self, name):94 def _generate_keys_zone(self, name):
95 return '{}-cache'.format(hashlib.md5(name.encode('UTF-8')).hexdigest()[0:12])95 return '{}-cache'.format(hashlib.md5(name.encode('UTF-8')).hexdigest()[0:12])
9696
97 def _process_locations(self, locations):97 def _process_locations(self, locations): # NOQA: C901
98 conf = {}98 conf = {}
99 for location, loc_conf in locations.items():99 for location, loc_conf in locations.items():
100 conf[location] = deepcopy(loc_conf)100 conf[location] = deepcopy(loc_conf)
@@ -118,6 +118,11 @@ class NginxConf:
118 elif 'cache-valid' in lc:118 elif 'cache-valid' in lc:
119 cache_val = lc['cache-valid']119 cache_val = lc['cache-valid']
120120
121 # No such thing as proxy_cache_maxconn, this is more used by
122 # HAProxy so remove/ignore here.
123 if 'cache-maxconn' in lc:
124 lc.pop('cache-maxconn')
125
121 lc['cache-valid'] = []126 lc['cache-valid'] = []
122 # Support multiple cache-validities per LP:1873116.127 # Support multiple cache-validities per LP:1873116.
123 if isinstance(cache_val, str):128 if isinstance(cache_val, str):
diff --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
index fba7847..2a1b852 100644
--- a/tests/unit/files/nginx_config_rendered_test_output-site3.local.txt
+++ b/tests/unit/files/nginx_config_rendered_test_output-site3.local.txt
@@ -15,7 +15,6 @@ server {
15 proxy_cache d515cd6e60b1-cache;15 proxy_cache d515cd6e60b1-cache;
16 proxy_cache_background_update on;16 proxy_cache_background_update on;
17 proxy_cache_lock on;17 proxy_cache_lock on;
18 proxy_cache_maxconn 4096;
19 proxy_cache_min_uses 1;18 proxy_cache_min_uses 1;
20 proxy_cache_revalidate on;19 proxy_cache_revalidate on;
21 proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;20 proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;

Subscribers

People subscribed via source and target branches