fix(cli): treat a malformed listener id like an unknown one

This commit is contained in:
Hugo Durand
2026-09-22 17:19:32 -04:00
parent 7ae82d40e3
commit 81d5c4e2d6
2 changed files with 68 additions and 24 deletions
+2 -1
View File
@@ -105,6 +105,7 @@ _OPERATOR_DEFAULT_RESOURCE_SPEC: Mapping[str, object] = {}
_CUSTOMER_REGISTRY_SOURCE: SourceName = "external_docker"
_LISTENER_REQUIRED_MARKER = "listener_id' is required"
_LISTENERS_SHOWN = 10
_LISTENER_NOT_FOUND_STATUSES = frozenset({404, 422})
_NO_LISTENERS = (
"This workspace has no listeners, so --listener-id and --k8s-namespace "
"do not apply."
@@ -1512,7 +1513,7 @@ def _requested_listener(client: HostBackendClient, listener_id: str) -> Listener
client, lambda c: c.get_listener(listener_id)
)
except HostBackendError as err:
if err.status_code != 404:
if err.status_code not in _LISTENER_NOT_FOUND_STATUSES:
raise
available = _available_listeners(client)
if not available: