X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fdevops.git;a=blobdiff_plain;f=installers%2Fcharm%2Fosm-nbi%2Fsrc%2Flegacy_interfaces.py;h=4750cffca0439fa625095244e22bf1bdf0d7153b;hp=5deb3f5f7cc6becc4e9830175429c1af2329e732;hb=38f5d5834d610e011b3608fe8cc34b927775204a;hpb=2dc01891e9c90760f7e421b53f7b63a89b5ce403 diff --git a/installers/charm/osm-nbi/src/legacy_interfaces.py b/installers/charm/osm-nbi/src/legacy_interfaces.py index 5deb3f5f..4750cffc 100644 --- a/installers/charm/osm-nbi/src/legacy_interfaces.py +++ b/installers/charm/osm-nbi/src/legacy_interfaces.py @@ -141,65 +141,3 @@ class KeystoneClient(BaseRelationClient): @property def admin_project_name(self): return self.get_data_from_app("admin_project_name") - - -class MongoClient(BaseRelationClient): - """Requires side of a Mongo Endpoint""" - - mandatory_fields_mapping = { - "reactive": ["connection_string"], - "ops": ["replica_set_uri", "replica_set_name"], - } - - def __init__(self, charm: ops.charm.CharmBase, relation_name: str): - super().__init__(charm, relation_name, mandatory_fields=[]) - - @property - def connection_string(self): - if self.is_opts(): - replica_set_uri = self.get_data_from_unit("replica_set_uri") - replica_set_name = self.get_data_from_unit("replica_set_name") - return f"{replica_set_uri}?replicaSet={replica_set_name}" - else: - return self.get_data_from_unit("connection_string") - - def is_opts(self): - return not self.is_missing_data_in_unit_ops() - - def is_missing_data_in_unit(self): - return self.is_missing_data_in_unit_ops() and self.is_missing_data_in_unit_reactive() - - def is_missing_data_in_unit_ops(self): - return not all( - [self.get_data_from_unit(field) for field in self.mandatory_fields_mapping["ops"]] - ) - - def is_missing_data_in_unit_reactive(self): - return not all( - [self.get_data_from_unit(field) for field in self.mandatory_fields_mapping["reactive"]] - ) - - -class PrometheusClient(BaseRelationClient): - """Requires side of a Prometheus Endpoint""" - - mandatory_fields = ["hostname", "port"] - - def __init__(self, charm: ops.charm.CharmBase, relation_name: str): - super().__init__(charm, relation_name, self.mandatory_fields) - - @property - def hostname(self): - return self.get_data_from_app("hostname") - - @property - def port(self): - return self.get_data_from_app("port") - - @property - def user(self): - return self.get_data_from_app("user") - - @property - def password(self): - return self.get_data_from_app("password")