Skip to content

Commit ebb5177

Browse files
committed
fixes(push) fixes host resolution
fixes #211
1 parent 3db5572 commit ebb5177

File tree

1 file changed

+11
-13
lines changed
  • main/cloudfoundry_client/operations/push

1 file changed

+11
-13
lines changed

main/cloudfoundry_client/operations/push/push.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,18 @@ def _build_new_requested_routes(
152152
_logger.error("Neither path nor port provided for route", requested_route)
153153
raise AssertionError("Cannot set both port and path for route: %s" % requested_route)
154154
host, domain_name, domain = PushOperation._resolve_domain(route, private_domains, shared_domains)
155-
if port is not None and host is not None:
156-
_logger.error("Host provided in route %s for tcp domain %s", requested_route, domain_name)
157-
raise AssertionError(
158-
"For route (%s) refers to domain %s that is a tcp one. It is hence routed by port and not by host"
159-
% (requested_route, domain_name)
160-
)
161155
route_to_map = None
162-
if port is not None and domain["entity"].get("router_group_type") != "tcp":
163-
_logger.error("Port provided in route %s for non tcp domain %s", requested_route, domain_name)
164-
raise AssertionError("Cannot set port on route(%s) for non tcp domain" % requested_route)
165-
elif domain["entity"].get("router_group_type") == "tcp" and port is None:
166-
_logger.error("No port provided in route %s for tcp domain %s", requested_route, domain_name)
167-
raise AssertionError("Please specify a port on route (%s) for tcp domain" % requested_route)
168-
elif domain["entity"].get("router_group_type") == "tcp":
156+
if port is not None:
157+
if domain["entity"].get("router_group_type") != "tcp":
158+
_logger.error("Port provided in route %s for non tcp domain %s", requested_route, domain_name)
159+
raise AssertionError("Cannot set port on route(%s) for non tcp domain" % requested_route)
160+
elif len(host) > 0:
161+
_logger.error("Host provided in route %s for tcp domain %s", requested_route, domain_name)
162+
raise AssertionError(
163+
"For route (%s) refers to domain %s that is a tcp one. "
164+
"It is hence routed by port and not by host"
165+
% (requested_route, domain_name)
166+
)
169167
if not any(
170168
[route["entity"]["domain_guid"] == domain["metadata"]["guid"] and route["entity"]["port"] == port]
171169
for route in existing_routes

0 commit comments

Comments
 (0)