File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
hpc_provisioner/src/hpc_provisioner Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 27
27
ClusterAlreadyRegistered ,
28
28
delete_cluster ,
29
29
dynamodb_resource ,
30
+ get_cluster_by_name ,
30
31
get_unclaimed_clusters ,
31
32
register_cluster ,
32
33
)
@@ -220,11 +221,24 @@ def pcluster_describe_handler(event, _context=None):
220
221
else :
221
222
logger .debug (f"describe pcluster { cluster } " )
222
223
try :
223
- pc_output = pcluster_describe (cluster )
224
- pc_output .update (
225
- get_secrets_for_cluster (sm_client = sm_client , cluster_name = cluster .name )
224
+ dynamo_output = get_cluster_by_name (
225
+ dynamodb_resource = dynamodb_resource (), cluster_name = cluster .name
226
226
)
227
- logger .debug (f"described pcluster { cluster } " )
227
+ if dynamo_output and dynamo_output .get ("provisioning_launched" , 0 ) == 0 :
228
+ cluster_from_dynamo = Cluster .from_dynamo_dict (dynamo_output )
229
+ pc_output = cluster_from_dynamo .as_dict ()
230
+ cluster_secrets = get_secrets_for_cluster (
231
+ sm_client = sm_client , cluster_name = cluster_from_dynamo .name
232
+ )
233
+ pc_output .update (cluster_secrets )
234
+
235
+ else :
236
+ pc_output = pcluster_describe (cluster )
237
+ pc_output .update (
238
+ get_secrets_for_cluster (sm_client = sm_client , cluster_name = cluster .name )
239
+ )
240
+ logger .debug (f"described pcluster { cluster } " )
241
+
228
242
except NotFoundException as e :
229
243
return {"statusCode" : 404 , "body" : e .content .message }
230
244
except Exception as e :
You can’t perform that action at this time.
0 commit comments