]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: add more ContainerDeamonForm methods to the snmp class
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 7 Nov 2023 22:57:43 +0000 (17:57 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 14 Nov 2023 21:05:48 +0000 (16:05 -0500)
Add methods customize_{container,process}_args to the snmp gateway
daemon type class. Use those methods in the get_container function.

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

index c9bc3a787579c0d802ee52370ab8fe9a7bb17abf..8225553c9271d18fe7f60c7990554ba722ddf7e7 100755 (executable)
@@ -558,6 +558,16 @@ class SNMPGateway(ContainerDaemonForm):
     def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
         return self.uid, self.gid
 
+    def customize_container_args(
+        self, ctx: CephadmContext, args: List[str]
+    ) -> None:
+        args.append(f'--env-file={self.conf_file_path}')
+
+    def customize_process_args(
+        self, ctx: CephadmContext, args: List[str]
+    ) -> None:
+        args.extend(self.get_daemon_args())
+
 
 ##################################
 @register_daemon_form
@@ -2896,11 +2906,9 @@ def get_container(
         binds = get_container_binds(ctx, ident)
         mounts = get_container_mounts(ctx, ident)
     elif daemon_type == SNMPGateway.daemon_type:
-        sg = SNMPGateway.init(ctx, ident.fsid, ident.daemon_id)
-        container_args.append(
-            f'--env-file={sg.conf_file_path}'
-        )
-        d_args.extend(sg.get_daemon_args())
+        sg = SNMPGateway.create(ctx, ident)
+        sg.customize_container_args(ctx, container_args)
+        sg.customize_process_args(ctx, d_args)
 
     _update_container_args_for_podman(ctx, ident, container_args)
     return CephContainer.for_daemon(