1616import yaml
1717
1818sys .path .append (os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))))
19- from confidential_compute import ConfidentialCompute , ConfidentialComputeConfig , SecretNotFoundException
19+ from confidential_compute import ConfidentialCompute , ConfidentialComputeConfig , SecretNotFoundException , ConfidentialComputeStartupException
2020
2121class AWSConfidentialComputeConfig (ConfidentialComputeConfig ):
2222 enclave_memory_mb : int
@@ -100,8 +100,7 @@ def add_defaults(configs: Dict[str, any]) -> AWSConfidentialComputeConfig:
100100 try :
101101 client = boto3 .client ("secretsmanager" , region_name = region )
102102 except Exception as e :
103- # MissingInstanceProfile
104- raise RuntimeError ("Please use IAM instance profile for your instance and make sure that has permission to access Secret Manager" )
103+ raise RuntimeError ("Please use IAM instance profile for your instance and make sure that has permission to access Secret Manager" , e )
105104 try :
106105 secret = add_defaults (json .loads (client .get_secret_value (SecretId = secret_identifier )["SecretString" ]))
107106 self .__validate_aws_specific_config (secret )
@@ -204,7 +203,7 @@ def __run_nitro_enclave(self):
204203 "--enclave-cid" , "42" ,
205204 "--enclave-name" , "uid2operator"
206205 ]
207- if self .configs [ " debug_mode" ]:
206+ if self .configs ( ' debug_mode' , True ): #E2E override
208207 print ("Running in debug_mode" )
209208 command += ["--debug-mode" , "--attach-console" ]
210209 self .run_command (command )
@@ -247,12 +246,14 @@ def __kill_auxiliaries(self) -> None:
247246 parser = argparse .ArgumentParser (description = "Manage EC2-based confidential compute workflows." )
248247 parser .add_argument ("-o" , "--operation" , choices = ["stop" , "start" ], default = "start" , help = "Operation to perform." )
249248 args = parser .parse_args ()
250- ec2 = EC2 ()
251249 try :
250+ ec2 = EC2 ()
252251 if args .operation == "stop" :
253252 ec2 .cleanup ()
254253 else :
255254 ec2 .run_compute ()
255+ except ConfidentialComputeStartupException as e :
256+ print ("Failed starting up Confidential Compute. Please find the error code and documentation" , e )
256257 except Exception as e :
257- print ("Failed starting up Confidential Compute. Please contact uid2 " , e )
258+ print ("Unknown failure while starting up Confidential Compute. Please contact UID support team with this log " , e )
258259
0 commit comments