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

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 86b914847ae1c32d1c1617ef144f100a53bad2ba
Merged at revision: 950bb86f185e83c5214bde20c74c14b5099d8c06
Proposed branch: ~hloeung/content-cache-charm:master
Merge into: content-cache-charm:master
Diff against target: 61 lines (+5/-2)
5 files modified
reactive/content_cache.py (+1/-0)
templates/nginx_cfg.tmpl (+1/-1)
tests/unit/files/config_test_config.txt (+1/-0)
tests/unit/files/nginx_config_rendered_test_output-site5.txt (+1/-1)
tests/unit/test_nginx.py (+1/-0)
Reviewer Review Type Date Requested Status
Joel Sing (community) +1 Approve
Review via email: mp+366152@code.launchpad.net

Commit message

Allow overriding Nginx's 'location' modifier

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
Joel Sing (jsing) wrote :

LGTM

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

Change successfully merged at revision 950bb86f185e83c5214bde20c74c14b5099d8c06

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/reactive/content_cache.py b/reactive/content_cache.py
index d40c75a..7f4f3a3 100644
--- a/reactive/content_cache.py
+++ b/reactive/content_cache.py
@@ -99,6 +99,7 @@ def configure_nginx(conf_path=None):
99 for location, loc_conf in site_conf.get('locations', {}).items():99 for location, loc_conf in site_conf.get('locations', {}).items():
100 conf['locations'][location] = {}100 conf['locations'][location] = {}
101 lc = conf['locations'][location]101 lc = conf['locations'][location]
102 lc['modifier'] = loc_conf.get('modifier')
102103
103 backend_port = loc_conf.get('backend_port')104 backend_port = loc_conf.get('backend_port')
104 if backend_port:105 if backend_port:
diff --git a/templates/nginx_cfg.tmpl b/templates/nginx_cfg.tmpl
index 25c6805..f84c6cc 100644
--- a/templates/nginx_cfg.tmpl
+++ b/templates/nginx_cfg.tmpl
@@ -6,7 +6,7 @@ server {
66
7{%- for location, conf in locations.items() %}7{%- for location, conf in locations.items() %}
88
9 location {{ location }} {9 location {% if conf['modifier'] %}{{conf['modifier']}} {% endif %}{{ location }} {
10{%- if conf['backend'] %}10{%- if conf['backend'] %}
11 proxy_pass {{conf['backend']}};11 proxy_pass {{conf['backend']}};
12 proxy_set_header Host "{{site}}";12 proxy_set_header Host "{{site}}";
diff --git a/tests/unit/files/config_test_config.txt b/tests/unit/files/config_test_config.txt
index 256217c..e074496 100644
--- a/tests/unit/files/config_test_config.txt
+++ b/tests/unit/files/config_test_config.txt
@@ -63,5 +63,6 @@ site5:
63 backends:63 backends:
64 - 127.0.1.10:8064 - 127.0.1.10:80
65 /auth:65 /auth:
66 modifier: '='
66 backends:67 backends:
67 - 127.0.1.11:8068 - 127.0.1.11:80
diff --git a/tests/unit/files/nginx_config_rendered_test_output-site5.txt b/tests/unit/files/nginx_config_rendered_test_output-site5.txt
index 3ff24d3..9425247 100644
--- a/tests/unit/files/nginx_config_rendered_test_output-site5.txt
+++ b/tests/unit/files/nginx_config_rendered_test_output-site5.txt
@@ -17,7 +17,7 @@ server {
17 }17 }
1818
1919
20 location /auth {20 location = /auth {
21 proxy_pass http://localhost:8084;21 proxy_pass http://localhost:8084;
22 proxy_set_header Host "site5.local";22 proxy_set_header Host "site5.local";
23 proxy_cache site5-cache;23 proxy_cache site5-cache;
diff --git a/tests/unit/test_nginx.py b/tests/unit/test_nginx.py
index f9ceb23..a58ef7e 100644
--- a/tests/unit/test_nginx.py
+++ b/tests/unit/test_nginx.py
@@ -55,6 +55,7 @@ class TestLibNginx(unittest.TestCase):
55 for location, loc_conf in site_conf.get('locations', {}).items():55 for location, loc_conf in site_conf.get('locations', {}).items():
56 conf['locations'][location] = {}56 conf['locations'][location] = {}
57 lc = conf['locations'][location]57 lc = conf['locations'][location]
58 lc['modifier'] = loc_conf.get('modifier')
5859
59 if loc_conf.get('backends'):60 if loc_conf.get('backends'):
60 backend_port += 161 backend_port += 1

Subscribers

People subscribed via source and target branches