From 8f297b5000192a27938a3896f14a755c65164f22 Mon Sep 17 00:00:00 2001 From: abuabraham-ttd Date: Mon, 9 Dec 2024 17:24:07 -0800 Subject: [PATCH] Updates --- scripts/aws/ec2.py | 1 - scripts/confidential_compute.py | 32 ++++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/scripts/aws/ec2.py b/scripts/aws/ec2.py index db7d5017b..2e972394f 100644 --- a/scripts/aws/ec2.py +++ b/scripts/aws/ec2.py @@ -89,7 +89,6 @@ def __add_defaults(self, configs: Dict[str, any]) -> ConfidentialComputeConfig: def __setup_vsockproxy(self, log_level: int) -> None: """ Sets up the vsock proxy service. - TODO: Evaluate adding vsock logging based on log_level here """ thread_count = (multiprocessing.cpu_count() + 1) // 2 command = [ diff --git a/scripts/confidential_compute.py b/scripts/confidential_compute.py index a154e37cb..9fc4b6d56 100644 --- a/scripts/confidential_compute.py +++ b/scripts/confidential_compute.py @@ -20,16 +20,6 @@ class ConfidentialCompute(ABC): def __init__(self): self.configs: ConfidentialComputeConfig = {} - @abstractmethod - def _get_secret(self, secret_identifier: str) -> ConfidentialComputeConfig: - """ - Fetches the secret from a secret store. - - Raises: - SecretNotFoundException: If the secret is not found. - """ - pass - def validate_environment(self): def validate_url(url_key, environment): if environment not in self.configs[url_key]: @@ -62,12 +52,6 @@ def validate_operator_key(self): f"Operator key does not match the expected environment ({expected_env})." ) return True - - @staticmethod - def __resolve_hostname(url: str) -> str: - """ Resolves the hostname of a URL to an IP address.""" - hostname = urlparse(url).netloc - return socket.gethostbyname(hostname) def validate_connectivity(self) -> None: """ Validates that the core and opt-out URLs are accessible.""" @@ -84,6 +68,17 @@ def validate_connectivity(self) -> None: ) except Exception as e: raise Exception("Failed to reach the URLs.") from e + + + @abstractmethod + def _get_secret(self, secret_identifier: str) -> ConfidentialComputeConfig: + """ + Fetches the secret from a secret store. + + Raises: + SecretNotFoundException: If the secret is not found. + """ + pass @abstractmethod def _setup_auxiliaries(self) -> None: @@ -100,6 +95,11 @@ def run_compute(self) -> None: """ Runs confidential computing.""" pass + @staticmethod + def __resolve_hostname(url: str) -> str: + """ Resolves the hostname of a URL to an IP address.""" + hostname = urlparse(url).netloc + return socket.gethostbyname(hostname) @staticmethod def run_command(command, seperate_process=False):