]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/cephadm: move haproxy client addrs to func
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 11 Jul 2023 20:29:44 +0000 (16:29 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:36:15 +0000 (13:36 -0400)
Move the list comprehension that gets the list of IP addresses for the
haproxy_hosts list to a separate function. This is in preparation for
making the logic more complex in a later commit.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit b1d2bb6ec53c2aa3574db2f5d3dc3878d2969a58)

src/pybind/mgr/cephadm/services/nfs.py

index 5a997ddda1233f50987e3b35195b07fd1bf09b28..715a0db729737c79d2c3a3ec42e45fbf22fccc12 100644 (file)
@@ -116,18 +116,7 @@ class NFSService(CephService):
                 "haproxy_hosts": [],
             }
             if spec.enable_haproxy_protocol:
-                # NB: Ideally, we would limit the list to IPs on hosts running
-                # haproxy/ingress only, but due to the nature of cephadm today
-                # we'd "only know the set of haproxy hosts after they've been
-                # deployed" (quoth @adk7398). As it is today we limit the list
-                # of hosts we know are managed by cephadm. That ought to be
-                # good enough to prevent acceping haproxy protocol messages
-                # from "rouge" systems that are not under our control. At
-                # least until we learn otherwise.
-                context["haproxy_hosts"] = [
-                    self.mgr.inventory.get_addr(h)
-                    for h in self.mgr.inventory.keys()
-                ]
+                context["haproxy_hosts"] = self._haproxy_hosts()
                 logger.debug("selected haproxy_hosts: %r", context["haproxy_hosts"])
             return self.mgr.template.render('services/nfs/ganesha.conf.j2', context)
 
@@ -311,3 +300,17 @@ class NFSService(CephService):
             stderr=subprocess.PIPE,
             timeout=10
         )
+
+    def _haproxy_hosts(self) -> List[str]:
+        # NB: Ideally, we would limit the list to IPs on hosts running
+        # haproxy/ingress only, but due to the nature of cephadm today
+        # we'd "only know the set of haproxy hosts after they've been
+        # deployed" (quoth @adk7398). As it is today we limit the list
+        # of hosts we know are managed by cephadm. That ought to be
+        # good enough to prevent acceping haproxy protocol messages
+        # from "rouge" systems that are not under our control. At
+        # least until we learn otherwise.
+        return [
+            self.mgr.inventory.get_addr(h)
+            for h in self.mgr.inventory.keys()
+        ]