Convert port to string. (#919)
All checks were successful
Lint Checks / Run linter (push) Successful in 40s
Publish / Build and publish (push) Successful in 1m19s
Smoke Test / Run basic test suite (push) Successful in 4m15s
Webapp Test / Run webapp test suite (push) Successful in 4m41s
Deploy Test / Run deploy test suite (push) Successful in 4m59s
Fixturenet-Laconicd-Test / Run Laconicd fixturenet and Laconic CLI tests (push) Successful in 13m12s
K8s Deploy Test / Run deploy test suite on kind/k8s (push) Successful in 7m48s

The str type check doesn't work if the port is a ruamel.yaml.scalarstring.SingleQuotedScalarString or ruamel.yaml.scalarstring.DoubleQuotedScalarString

Reviewed-on: #919
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
This commit is contained in:
Thomas E Lackey 2024-08-14 00:25:35 +00:00 committed by Thomas E Lackey
parent 65c1cdf6b1
commit 8576137557

View File

@ -86,10 +86,10 @@ class ClusterInfo:
for service_name in services: for service_name in services:
service_info = services[service_name] service_info = services[service_name]
if "ports" in service_info: if "ports" in service_info:
for raw_port in service_info["ports"]: for raw_port in [str(p) for p in service_info["ports"]]:
if opts.o.debug: if opts.o.debug:
print(f"service port: {raw_port}") print(f"service port: {raw_port}")
if type(raw_port) is str and ":" in raw_port: if ":" in raw_port:
parts = raw_port.split(":") parts = raw_port.split(":")
if len(parts) != 2: if len(parts) != 2:
raise Exception(f"Invalid port definition: {raw_port}") raise Exception(f"Invalid port definition: {raw_port}")