Skip to content

Commit 9facbe3

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
kmip: update keybridge kmip scope to use host, port pairs
Signed-off-by: John Mulligan <[email protected]>
1 parent b50f1a1 commit 9facbe3

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

sambacc/commands/satellite/keybridge.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ def _kmip_scope(
214214

215215
return sambacc.kmip.scope.KMIPScope(
216216
scope_cfg.subname,
217-
hostnames=scope_cfg.hostnames,
218-
port=scope_cfg.port,
217+
hosts=scope_cfg.host_ports,
219218
tls_paths=sambacc.kmip.scope.TLSPaths(**tls),
220219
)
221220

sambacc/kmip/scope.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,19 @@ def __init__(
6464
self,
6565
kmip_name: str,
6666
*,
67-
hostnames: typing.Collection[str],
68-
port: int,
67+
hosts: typing.Collection[tuple[str, int]],
6968
tls_paths: TLSPaths,
7069
) -> None:
7170
self.kmip_name = kmip_name
72-
self.hostnames = hostnames
73-
self.port = port
71+
self.hosts = hosts
7472
self.tls_paths = tls_paths
7573
self._kmip_version = kmip_enums.KMIPVersion.KMIP_1_2
7674
self._cache_lock = threading.Lock()
7775
self._kmip_cache: dict[str, _Value] = {}
7876
_logger.debug(
79-
"Created KMIP Scope with name=%r, hostnames=%r, port=%r, tls=%r",
77+
"Created KMIP Scope with name=%r, hosts=%r, tls=%r",
8078
self.kmip_name,
81-
self.hostnames,
82-
self.port,
79+
self.hosts,
8380
self.tls_paths,
8481
)
8582

@@ -96,11 +93,11 @@ def about(self) -> ScopeInfo:
9693

9794
@contextlib.contextmanager
9895
def _client(self) -> typing.Iterator[ProxyKmipClient]:
99-
for hostname in self.hostnames:
96+
for hostname, port in self.hosts:
10097
try:
10198
client = ProxyKmipClient(
10299
hostname=hostname,
103-
port=self.port,
100+
port=port,
104101
cert=self.tls_paths.cert,
105102
key=self.tls_paths.key,
106103
ca=self.tls_paths.ca_cert,

0 commit comments

Comments
 (0)