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

Proposed by Haw Loeung
Status: Merged
Approved by: Barry Price
Approved revision: 13f9f2a29760ee263590e60e1e4cacec8c458b8f
Merged at revision: 98223eb762ed80bfa0d3b49071ec0dec015587f3
Proposed branch: ~hloeung/content-cache-charm:cleanup
Merge into: content-cache-charm:master
Diff against target: 102 lines (+13/-11)
5 files modified
reactive/content_cache.py (+8/-5)
tests/unit/test_content_cache.py (+1/-1)
tests/unit/test_haproxy.py (+2/-3)
tests/unit/test_nginx.py (+1/-1)
tests/unit/test_utils.py (+1/-1)
Reviewer Review Type Date Requested Status
Barry Price Approve
Canonical IS Reviewers Pending
Review via email: mp+374495@code.launchpad.net

Commit message

Reformatted by black

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 98223eb762ed80bfa0d3b49071ec0dec015587f3

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reactive/content_cache.py b/reactive/content_cache.py
2index 0beb6b6..68462fb 100644
3--- a/reactive/content_cache.py
4+++ b/reactive/content_cache.py
5@@ -2,9 +2,10 @@ import datetime
6 import grp
7 import os
8 import pwd
9-import yaml
10 from copy import deepcopy
11
12+import yaml
13+
14 from charms import reactive
15 from charms.layer import status
16 from charmhelpers import context
17@@ -414,13 +415,15 @@ def sites_from_config(sites_yaml, sites_secrets=None, blacklist_ports=None):
18 cache_port = 0
19 backend_port = 0
20 for site, site_conf in sites.items():
21- (cache_port, unused_backend_port) = utils.next_port_pair(cache_port, backend_port,
22- blacklist_ports=blacklist_ports)
23+ (cache_port, unused_backend_port) = utils.next_port_pair(
24+ cache_port, backend_port, blacklist_ports=blacklist_ports
25+ )
26 site_conf['cache_port'] = cache_port
27 for location, loc_conf in site_conf.get('locations', {}).items():
28 if loc_conf and loc_conf.get('backends'):
29- (unused_cache_port, backend_port) = utils.next_port_pair(cache_port, backend_port,
30- blacklist_ports=blacklist_ports)
31+ (unused_cache_port, backend_port) = utils.next_port_pair(
32+ cache_port, backend_port, blacklist_ports=blacklist_ports
33+ )
34 loc_conf['backend_port'] = backend_port
35 return sites
36
37diff --git a/tests/unit/test_content_cache.py b/tests/unit/test_content_cache.py
38index 428e996..8182187 100644
39--- a/tests/unit/test_content_cache.py
40+++ b/tests/unit/test_content_cache.py
41@@ -605,7 +605,7 @@ site1.local:
42 'port': 80,
43 'cache_port': 6081,
44 'locations': {'/': {'backend_port': 8081, 'backends': ['91.189.88.152:80']}},
45- },
46+ }
47 }
48 self.assertEqual(want, content_cache.sites_from_config(config_yaml, blacklist_ports=blacklist_ports))
49
50diff --git a/tests/unit/test_haproxy.py b/tests/unit/test_haproxy.py
51index bebf100..4c7ade0 100644
52--- a/tests/unit/test_haproxy.py
53+++ b/tests/unit/test_haproxy.py
54@@ -3,9 +3,9 @@ import shutil
55 import sys
56 import tempfile
57 import unittest
58-import yaml
59
60 import freezegun
61+import yaml
62
63 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
64 from lib import haproxy as HAProxy # NOQA: E402
65@@ -38,8 +38,7 @@ class TestLibHAProxy(unittest.TestCase):
66 # Site names longer than 32 characters include a partial hash of
67 # the original name.
68 self.assertEqual(
69- haproxy._generate_stanza_name('site1-canonical-com-canonical-com'),
70- 'site1-canonical-com-cano-7ecd6aa',
71+ haproxy._generate_stanza_name('site1-canonical-com-canonical-com'), 'site1-canonical-com-cano-7ecd6aa'
72 )
73 self.assertEqual(
74 haproxy._generate_stanza_name('site1-canonical-com-canonical-com-canonical-com'),
75diff --git a/tests/unit/test_nginx.py b/tests/unit/test_nginx.py
76index a419a37..e66f599 100644
77--- a/tests/unit/test_nginx.py
78+++ b/tests/unit/test_nginx.py
79@@ -3,9 +3,9 @@ import shutil
80 import sys
81 import tempfile
82 import unittest
83-import yaml
84
85 import jinja2
86+import yaml
87
88 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
89 from lib import nginx # NOQA: E402
90diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
91index c5d426c..ac7c417 100644
92--- a/tests/unit/test_utils.py
93+++ b/tests/unit/test_utils.py
94@@ -34,7 +34,7 @@ class TestLibUtils(unittest.TestCase):
95 # Blacklisted ports
96 self.assertEqual(
97 utils.next_port_pair(0, 0, blacklist_ports=[utils.BASE_CACHE_PORT, utils.BASE_BACKEND_PORT]),
98- (utils.BASE_CACHE_PORT + 1, utils.BASE_BACKEND_PORT + 1)
99+ (utils.BASE_CACHE_PORT + 1, utils.BASE_BACKEND_PORT + 1),
100 )
101
102 def test_next_port_pair_out_of_range(self):

Subscribers

People subscribed via source and target branches