Skip to content

Commit 711d50b

Browse files
Move validations around
1 parent 44aa71f commit 711d50b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

scripts/confidential_compute.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ def validate_url(url_key, environment):
5151
f"{url_key} is invalid. Ensure {self.configs[url_key]} follows HTTPS, and doesn't have any path specified."
5252
)
5353

54-
def validate_connectivity(self) -> None:
54+
def validate_connectivity() -> None:
5555
""" Validates that the core and opt-out URLs are accessible."""
5656
try:
5757
core_url = self.configs["core_base_url"]
5858
optout_url = self.configs["optout_base_url"]
59-
core_ip = self.__resolve_hostname(core_url)
59+
core_ip = socket.gethostbyname(urlparse(core_url).netloc)
6060
requests.get(core_url, timeout=5)
61-
optout_ip = self.__resolve_hostname(optout_url)
61+
optout_ip = socket.gethostbyname(urlparse(optout_url).netloc)
6262
requests.get(optout_url, timeout=5)
6363
except (requests.ConnectionError, requests.Timeout) as e:
6464
raise Exception(
@@ -108,12 +108,6 @@ def run_compute(self) -> None:
108108
""" Runs confidential computing."""
109109
pass
110110

111-
@staticmethod
112-
def __resolve_hostname(url: str) -> str:
113-
""" Resolves the hostname of a URL to an IP address."""
114-
hostname = urlparse(url).netloc
115-
return socket.gethostbyname(hostname)
116-
117111
@staticmethod
118112
def run_command(command, seperate_process=False):
119113
print(f"Running command: {' '.join(command)}")

0 commit comments

Comments
 (0)