@register_daemon_form
-class Keepalived(DaemonForm):
+class Keepalived(ContainerDaemonForm):
"""Defines an Keepalived container"""
daemon_type = 'keepalived'
required_files = ['keepalived.conf']
'net.ipv4.ip_nonlocal_bind = 1',
]
- def extract_uid_gid_keepalived(self) -> Tuple[int, int]:
+ def uid_gid(self, ctx: CephadmContext) -> Tuple[int, int]:
# better directory for this?
return extract_uid_gid(self.ctx, file_path='/var/lib')
mounts[os.path.join(data_dir, 'keepalived.conf')] = '/etc/keepalived/keepalived.conf'
return mounts
+ def container(self, ctx: CephadmContext) -> CephContainer:
+ return get_deployment_container(ctx, self.identity)
+
+
##################################
endpoints=daemon_endpoints,
)
- elif daemon_type == Keepalived.daemon_type:
- keepalived = Keepalived.init(ctx, ident.fsid, ident.daemon_id)
- uid, gid = keepalived.extract_uid_gid_keepalived()
- c = get_deployment_container(ctx, ident)
- deploy_daemon(
- ctx,
- ident,
- c,
- uid,
- gid,
- deployment_type=deployment_type,
- endpoints=daemon_endpoints,
- )
-
elif daemon_type == CephadmAgent.daemon_type:
# get current user gid and uid
uid = os.getuid()
)
with mock.patch("cephadm.CephContainer") as cc:
cc.return_value.run.return_value = "500 500"
- uid, gid = kad.extract_uid_gid_keepalived()
+ uid, gid = kad.uid_gid(ctx)
cc.return_value.run.assert_called()
assert uid == 500
assert gid == 500