File tree 1 file changed +13
-4
lines changed
src/aleph_client/commands 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -229,8 +229,10 @@ def display_table_for(
229
229
row .append (internet_cell )
230
230
table .add_row (* row )
231
231
232
- tier_data [tier_id ] = SelectedTier (
233
- tier = tier_id ,
232
+ # Convert tier_id to int to ensure consistent typing
233
+ tier_id_int = int (tier_id )
234
+ tier_data [tier_id_int ] = SelectedTier (
235
+ tier = tier_id_int ,
234
236
compute_units = current_units ,
235
237
vcpus = unit_vcpus * current_units ,
236
238
memory = unit_memory * current_units ,
@@ -302,9 +304,16 @@ def display_table_for(
302
304
)
303
305
304
306
if selector and pricing_entity not in [PricingEntity .STORAGE , PricingEntity .WEB3_HOSTING ]:
307
+ # Make sure tier_data has at least one element before proceeding
308
+ if not tier_data :
309
+ typer .echo (f"No valid tiers found for { pricing_entity .value } " )
310
+ raise typer .Exit (1 )
311
+
305
312
if not auto_selected :
306
- tier_id = validated_prompt ("Select a tier by index" , lambda tier_id : tier_id in tier_data )
307
- return next (iter (tier_data .values ())) if auto_selected else tier_data [tier_id ]
313
+ tier_id = validated_prompt ("Select a tier by index" , lambda tier_id : int (tier_id ) in tier_data )
314
+ # Convert tier_id to integer since we store it as integer keys in tier_data
315
+ return tier_data [int (tier_id )]
316
+ return next (iter (tier_data .values ()))
308
317
309
318
return None
310
319
You can’t perform that action at this time.
0 commit comments