]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add more ContainerDeamonForm methods to the haproxy class
authorJohn Mulligan <jmulligan@redhat.com>
Sun, 5 Nov 2023 12:56:29 +0000 (07:56 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 14 Nov 2023 21:05:48 +0000 (16:05 -0500)
Add methods customize_{container_args,process_args} to the haproxy
daemon type class. Use those methods in the get_container function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index 242f2fa35cab80bb563200e93f2110cb3a8569d5..c82e53f0b8475def39a917db291a5489bd98e3c2 100755 (executable)
@@ -1637,6 +1637,19 @@ class HAproxy(ContainerDaemonForm):
         ctr = get_container(ctx, self.identity)
         return to_deployment_container(ctx, ctr)
 
+    def customize_container_args(
+        self, ctx: CephadmContext, args: List[str]
+    ) -> None:
+        args.extend(
+            ['--user=root']
+        )  # haproxy 2.4 defaults to a different user
+
+    def customize_process_args(
+        self, ctx: CephadmContext, args: List[str]
+    ) -> None:
+        args.extend(self.get_daemon_args())
+
+
 ##################################
 
 
@@ -2909,10 +2922,9 @@ def get_container(
         ceph_exporter = CephExporter.init(ctx, ident.fsid, ident.daemon_id)
         d_args.extend(ceph_exporter.get_daemon_args())
     elif daemon_type == HAproxy.daemon_type:
-        name = ident.daemon_name
-        container_args.extend(['--user=root'])  # haproxy 2.4 defaults to a different user
-        haproxy = HAproxy.init(ctx, ident.fsid, ident.daemon_id)
-        d_args.extend(haproxy.get_daemon_args())
+        haproxy = HAproxy.create(ctx, ident)
+        haproxy.customize_container_args(ctx, container_args)
+        haproxy.customize_process_args(ctx, d_args)
         mounts = get_container_mounts(ctx, ident)
     elif daemon_type == Keepalived.daemon_type:
         keepalived = Keepalived.create(ctx, ident)