cephadm: convert SNMPGateway to a ContainerDaemonForm

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2023-09-23 15:28:40 -04:00
parent be3e552717
commit e82baf51be

View File

@ -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(