@@ -37,9 +37,13 @@ async def resolve_alias_to_id(
37
37
38
38
try :
39
39
record = await default_kvs_client .get_record (_ALIAS_MAPPING_KEY )
40
+ logger .info (f'resolving record: { record } ' )
40
41
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 ])
43
47
44
48
except Exception as exc :
45
49
# If there's any error accessing the record, treat it as not found
@@ -69,15 +73,19 @@ async def store_alias_mapping(
69
73
70
74
try :
71
75
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
72
80
73
81
# 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
76
84
else :
77
- record = {alias_key : storage_id }
85
+ alias_data = {alias_key : storage_id }
78
86
79
87
# 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 )
81
89
except Exception as exc :
82
90
logger .warning (f'Error accessing alias mapping for { alias } : { exc } ' )
83
91
0 commit comments