Allow ClusterNode.__init__ with missing services
Not all component test environments will provide full set of services. It's ok for gateways and even storage nodes to be completely missing. Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
parent
9261d46ed5
commit
1fbd7b7de1
1 changed files with 13 additions and 6 deletions
|
@ -161,17 +161,24 @@ class Cluster:
|
|||
This class represents a Cluster object for the whole storage based on provided hosting
|
||||
"""
|
||||
|
||||
default_rpc_endpoint: str
|
||||
default_s3_gate_endpoint: str
|
||||
default_http_gate_endpoint: str
|
||||
default_rpc_endpoint: str = "not deployed"
|
||||
default_s3_gate_endpoint: str = "not deployed"
|
||||
default_http_gate_endpoint: str = "not deployed"
|
||||
|
||||
def __init__(self, hosting: Hosting) -> None:
|
||||
self._hosting = hosting
|
||||
|
||||
self.class_registry = get_service_registry()
|
||||
self.default_rpc_endpoint = self.services(StorageNode)[0].get_rpc_endpoint()
|
||||
self.default_s3_gate_endpoint = self.services(S3Gate)[0].get_endpoint()
|
||||
self.default_http_gate_endpoint = self.services(HTTPGate)[0].get_endpoint()
|
||||
|
||||
storage = self.services(StorageNode)
|
||||
if storage:
|
||||
self.default_rpc_endpoint = storage[0].get_rpc_endpoint()
|
||||
s3gate = self.services(S3Gate)
|
||||
if s3gate:
|
||||
self.default_s3_gate_endpoint = s3gate[0].get_endpoint()
|
||||
http_gate = self.services(HTTPGate)
|
||||
if http_gate:
|
||||
self.default_http_gate_endpoint = http_gate[0].get_endpoint()
|
||||
|
||||
@property
|
||||
def hosts(self) -> list[Host]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue