Merge ~mthaddon/charm-k8s-ingress/+git/charm-k8s-ingress:docstrings into charm-k8s-ingress:master

Proposed by Tom Haddon
Status: Merged
Approved by: Jon Seager
Approved revision: e7f7b40b56d1e63a6b906d2cf85e0dc7c1ca849f
Merged at revision: 03f3bab57865d795c3e2fd3739d56b359274ef3d
Proposed branch: ~mthaddon/charm-k8s-ingress/+git/charm-k8s-ingress:docstrings
Merge into: charm-k8s-ingress:master
Diff against target: 50 lines (+9/-1)
2 files modified
src/charm.py (+8/-0)
tests/unit/test_charm.py (+1/-1)
Reviewer Review Type Date Requested Status
Jon Seager Approve
🤖 prod-jenkaas-is (community) continuous-integration Approve
Review via email: mp+415662@code.launchpad.net

Commit message

Add docstrings and remove note referring to an individual in unit tests

Description of the change

Add docstrings and remove note referring to an individual in unit tests

To post a comment you must log in.
Revision history for this message
🤖 prod-jenkaas-is (prod-jenkaas-is) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

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
🤖 prod-jenkaas-is (prod-jenkaas-is) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jon Seager (jnsgruk) wrote :

LGTM

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

Change successfully merged at revision 03f3bab57865d795c3e2fd3739d56b359274ef3d

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/charm.py b/src/charm.py
2index b3bf263..e2fb7fb 100755
3--- a/src/charm.py
4+++ b/src/charm.py
5@@ -354,6 +354,7 @@ class NginxIngressCharm(CharmBase):
6
7 @property
8 def _all_config_or_relations(self):
9+ """Get all configuration and relation data."""
10 all_relations = self.model.relations["ingress"] or [None]
11 multiple_rels = self._multiple_relations
12 return [
13@@ -363,10 +364,16 @@ class NginxIngressCharm(CharmBase):
14
15 @property
16 def _multiple_relations(self):
17+ """Return a boolean indicating if we're related to multiple applications."""
18 return len(self.model.relations["ingress"]) > 1
19
20 @property
21 def _namespace(self):
22+ """Namespace for this ingress."""
23+ # We're querying the first one here because this will always be the same
24+ # for all instances. It would be very unusual for a relation to specify
25+ # this (arguably we should remove this as a relation option), so if set
26+ # via config it will be the same for all relations.
27 return self._all_config_or_relations[0]._namespace
28
29 def _describe_ingresses_action(self, event):
30@@ -514,6 +521,7 @@ class NginxIngressCharm(CharmBase):
31 self._define_ingress(ingress)
32
33 def _process_ingresses(self, ingresses):
34+ """Process ingresses, or raise an exception if there are unresolvable conflicts."""
35 # If there are Ingress rules for the same service-hostname, we need to squash those
36 # rules together. This will be used to group the rules by their host.
37 ingress_paths = {}
38diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py
39index d11634d..c4cc9cf 100644
40--- a/tests/unit/test_charm.py
41+++ b/tests/unit/test_charm.py
42@@ -969,7 +969,7 @@ class TestCharmMultipleRelations(unittest.TestCase):
43 def test_get_multiple_ingress_relation_data(self):
44 """Test for getting our multiple ingress relation data."""
45 # Confirm we don't have any relation data yet in the relevant properties
46- # NOTE(claudiub): _all_config_or_relations will always have at least one element.
47+ # NOTE: _all_config_or_relations will always have at least one element.
48 conf_or_rels = self.harness.charm._all_config_or_relations
49 self.assertEqual(0, len(self.harness.charm.model.relations['ingress']))
50 self.assertEqual(1, len(conf_or_rels))

Subscribers

People subscribed via source and target branches

to all changes: