← Back to team overview

bind-charmers team mailing list archive

[Merge] ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:docstrings into charm-k8s-bind:master

 

Barry Price has proposed merging ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:docstrings into charm-k8s-bind:master.

Commit message:
Add missing docstrings, remove a useless method that only ever called another one

Requested reviews:
  Canonical IS Reviewers (canonical-is-reviewers)
  Bind Charmers (bind-charmers)

For more details, see:
https://code.launchpad.net/~barryprice/charm-k8s-bind/+git/charm-k8s-bind/+merge/388527
-- 
Your team Bind Charmers is requested to review the proposed merge of ~barryprice/charm-k8s-bind/+git/charm-k8s-bind:docstrings into charm-k8s-bind:master.
diff --git a/src/charm.py b/src/charm.py
index 8754cfa..0e6e743 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -18,6 +18,7 @@ REQUIRED_SETTINGS = ['bind_image_path']
 
 class BindK8sCharm(CharmBase):
     def __init__(self, *args):
+        """Initialise our class, we only care about 'start' and 'config-changed' hooks."""
         super().__init__(*args)
         self.framework.observe(self.on.start, self.on_config_changed)
         self.framework.observe(self.on.config_changed, self.on_config_changed)
@@ -47,11 +48,9 @@ class BindK8sCharm(CharmBase):
         return sorted(list(set(missing)))
 
     def on_config_changed(self, event):
-        self.configure_pod()
-
-    def configure_pod(self):
-        # Only the leader can set_spec().
+        """Check that we're leader, and if so, set up the pod."""
         if self.model.unit.is_leader():
+            # Only the leader can set_spec().
             resources = self.make_pod_resources()
             spec = self.make_pod_spec()
             spec.update(resources)
@@ -107,6 +106,7 @@ class BindK8sCharm(CharmBase):
         return pod_config
 
     def make_pod_spec(self):
+        """Set up and return our full pod spec here."""
         config = self.model.config
         full_pod_config = self.generate_pod_config(secured=False)
         secure_pod_config = self.generate_pod_config(secured=True)

References