Skip to content

Commit

Permalink
fix bad whitespace in url format for azure compute instance base url (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
imatiach-msft committed Feb 14, 2024
1 parent 66da2c0 commit c647df1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions rai_core_flask/rai_core_flask/environments/azure_nb_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
AZURE_NB = "azure_nb"


def get_url_format(is_private_link, instance_name, domain_suffix, port):
if is_private_link:
return f"{instance_name}.{domain_suffix}:{port}"
return f"{instance_name}-{port}.{domain_suffix}"


class AzureNBEnvironment(BaseEnvironment):
"""Environment class for Azure notebook environments.
Expand All @@ -36,14 +42,10 @@ def __init__(self, service):
else:
instance_name = self.nbvm["instance"]
domain_suffix = self.nbvm["domainsuffix"]
if service.is_private_link:
url_format = f"{instance_name}.{domain_suffix}\
:{service.port}"
else:
url_format = f"{instance_name}-{service.port}\
.{domain_suffix}"
self.base_url = \
f"https://{url_format}"
url_format = get_url_format(
service.is_private_link, instance_name, domain_suffix,
service.port)
self.base_url = f"https://{url_format}"
self.successfully_detected = True
self.nbvm_origins = [
f"https://{instance_name}.{domain_suffix}",
Expand Down

0 comments on commit c647df1

Please sign in to comment.