@@ -37,9 +37,13 @@ async def resolve_alias_to_id(
3737
3838 try :
3939 record = await default_kvs_client .get_record (_ALIAS_MAPPING_KEY )
40+ logger .info (f'resolving record: { record } ' )
4041
41- if isinstance (record , dict ) and alias_key in record :
42- return str (record [alias_key ])
42+ # Extract the actual data from the KVS record
43+ alias_data = record .get ('value' ) if isinstance (record , dict ) else record
44+
45+ if isinstance (alias_data , dict ) and alias_key in alias_data :
46+ return str (alias_data [alias_key ])
4347
4448 except Exception as exc :
4549 # If there's any error accessing the record, treat it as not found
@@ -69,15 +73,19 @@ async def store_alias_mapping(
6973
7074 try :
7175 record = await default_kvs_client .get_record (_ALIAS_MAPPING_KEY )
76+ logger .info (f'storing record: { record } ' )
77+
78+ # Extract the actual data from the KVS record
79+ alias_data = record .get ('value' ) if isinstance (record , dict ) else None
7280
7381 # Update or create the record with the new alias mapping
74- if isinstance (record , dict ) and alias_key in record :
75- record [alias_key ] = storage_id
82+ if isinstance (alias_data , dict ):
83+ alias_data [alias_key ] = storage_id
7684 else :
77- record = {alias_key : storage_id }
85+ alias_data = {alias_key : storage_id }
7886
7987 # Store the mapping back in the KVS.
80- await default_kvs_client .set_record (_ALIAS_MAPPING_KEY , record )
88+ await default_kvs_client .set_record (_ALIAS_MAPPING_KEY , alias_data )
8189 except Exception as exc :
8290 logger .warning (f'Error accessing alias mapping for { alias } : { exc } ' )
8391
0 commit comments