Skip to content

Commit

Permalink
Create custom exceptions and link it to website
Browse files Browse the repository at this point in the history
  • Loading branch information
abuabraham-ttd committed Dec 27, 2024
1 parent 881cafb commit cd730d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions scripts/aws/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import requests
import signal
import argparse
from botocore.exceptions import ClientError
from botocore.exceptions import ClientError, NoCredentialsError
from typing import Dict
import sys
import time
Expand Down Expand Up @@ -97,14 +97,13 @@ def add_defaults(configs: Dict[str, any]) -> AWSConfidentialComputeConfig:

region = self.__get_current_region()
print(f"Running in {region}")
try:
client = boto3.client("secretsmanager", region_name=region)
except Exception as e:
raise MissingInstanceProfile(self.__class__.__name__)
client = boto3.client("secretsmanager", region_name=region)
try:
secret = add_defaults(json.loads(client.get_secret_value(SecretId=secret_identifier)["SecretString"]))
self.__validate_aws_specific_config(secret)
return secret
except NoCredentialsError as _:
raise MissingInstanceProfile(self.__class__.__name__)
except ClientError as _:
raise ConfigNotFound(self.__class__.__name__, f"{secret_identifier} in {region}")

Expand Down
2 changes: 1 addition & 1 deletion scripts/confidential_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, error_name, provider, extra_message):
"GCP": "https://unifiedid.com/docs/guides/operator-private-gcp-confidential-space#uid2-operator-error-codes",
}
url = urls.get(provider)
super().__init__(f"{error_name} \n" + (extra_message if extra_message else "") + f" \n Visit {url} for more details")
super().__init__(f"{error_name} \n" + (extra_message if extra_message else "") + f"\nVisit {url} for more details")

class MissingInstanceProfile(ConfidentialComputeStartupException):
def __init__(self, cls):
Expand Down

0 comments on commit cd730d3

Please sign in to comment.