]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: convert SNMPGateway to a ContainerDaemonForm
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 23 Sep 2023 19:28:40 +0000 (15:28 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 4 Oct 2023 19:17:57 +0000 (15:17 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index 97419dded0bc8cd92e9706d39151da7e5c05d9b7..8869881de423e06d38084dfb40b4ba545b804789 100755 (executable)
@@ -262,7 +262,7 @@ class OSD(Ceph):
 
 
 @register_daemon_form
-class SNMPGateway(DaemonForm):
+class SNMPGateway(ContainerDaemonForm):
     """Defines an SNMP gateway between Prometheus and SNMP monitoring Frameworks"""
     daemon_type = 'snmp-gateway'
     SUPPORTED_VERSIONS = ['V2c', 'V3']
@@ -414,6 +414,12 @@ class SNMPGateway(DaemonForm):
         if not self.destination:
             raise Error('config is missing destination attribute(<ip>:<port>) of the target SNMP listener')
 
+    def container(self, ctx: CephadmContext) -> CephContainer:
+        return get_deployment_container(ctx, self.identity)
+
+    def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
+        return self.uid, self.gid
+
 
 ##################################
 @register_daemon_form
@@ -5241,18 +5247,6 @@ def _dispatch_deploy(
             endpoints=daemon_endpoints,
         )
 
-    elif daemon_type == SNMPGateway.daemon_type:
-        sc = SNMPGateway.init(ctx, ident.fsid, ident.daemon_id)
-        c = get_deployment_container(ctx, ident)
-        deploy_daemon(
-            ctx,
-            ident,
-            c,
-            sc.uid,
-            sc.gid,
-            deployment_type=deployment_type,
-            endpoints=daemon_endpoints,
-        )
     else:
         try:
             _deploy_daemon_container(