Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
abuabraham-ttd committed Dec 10, 2024
1 parent f42f872 commit 8f297b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion scripts/aws/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
32 changes: 16 additions & 16 deletions scripts/confidential_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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."""
Expand All @@ -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:
Expand All @@ -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):
Expand Down

0 comments on commit 8f297b5

Please sign in to comment.