@register_daemon_form
-class HAproxy(DaemonForm):
+class HAproxy(ContainerDaemonForm):
"""Defines an HAproxy container"""
daemon_type = 'haproxy'
required_files = ['haproxy.cfg']
cname = '%s-%s' % (cname, desc)
return cname
- def extract_uid_gid_haproxy(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')
'net.ipv4.ip_nonlocal_bind = 1',
]
+ def container(self, ctx: CephadmContext) -> CephContainer:
+ return get_deployment_container(ctx, self.identity)
+
##################################
deployment_type=deployment_type,
endpoints=daemon_endpoints,
)
- elif daemon_type == HAproxy.daemon_type:
- haproxy = HAproxy.init(ctx, ident.fsid, ident.daemon_id)
- uid, gid = haproxy.extract_uid_gid_haproxy()
- 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
)
with mock.patch("cephadm.CephContainer") as cc:
cc.return_value.run.return_value = "500 500"
- uid, gid = hap.extract_uid_gid_haproxy()
+ uid, gid = hap.uid_gid(ctx)
cc.return_value.run.assert_called()
assert uid == 500
assert gid == 500