Handle keys of none primary name
@@ -156,11 +156,13 @@ class Replicas:
@property
def primary_name_by_inst_id(self) -> dict:
- return {r.instId: r.primaryName.split(":", maxsplit=1)[0] for r in self._replicas.values()}
+ return {r.instId: r.primaryName.split(":", maxsplit=1)[0] if r.primaryName else None
+ for r in self._replicas.values()}
@property
def inst_id_by_primary_name(self) -> dict:
- return {r.primaryName.split(":", maxsplit=1)[0]: r.instId for r in self._replicas.values()}
+ return {r.primaryName.split(":", maxsplit=1)[0]: r.instId
+ for r in self._replicas.values() if r.primaryName}
def register_new_ledger(self, ledger_id):
for replica in self._replicas.values():
