@@ -220,7 +220,7 @@ fn process_command(
220
220
Commands :: SledAdd ( args) => cmd_sled_add ( sim, args) ,
221
221
Commands :: SledRemove ( args) => cmd_sled_remove ( sim, args) ,
222
222
Commands :: SledShow ( args) => cmd_sled_show ( sim, args) ,
223
- Commands :: SledSetPolicy ( args) => cmd_sled_set_policy ( sim, args) ,
223
+ Commands :: SledSet ( args) => cmd_sled_set ( sim, args) ,
224
224
Commands :: SledUpdateInstallDataset ( args) => {
225
225
cmd_sled_update_install_dataset ( sim, args)
226
226
}
@@ -277,8 +277,8 @@ enum Commands {
277
277
SledRemove ( SledRemoveArgs ) ,
278
278
/// show details about one sled
279
279
SledShow ( SledArgs ) ,
280
- /// set a sled's policy
281
- SledSetPolicy ( SledSetPolicyArgs ) ,
280
+ /// set a value on a sled
281
+ SledSet ( SledSetArgs ) ,
282
282
/// update the install dataset on a sled, simulating a mupdate
283
283
SledUpdateInstallDataset ( SledUpdateInstallDatasetArgs ) ,
284
284
/// simulate updating the sled's SP versions
@@ -361,11 +361,24 @@ struct SledArgs {
361
361
}
362
362
363
363
#[ derive( Debug , Args ) ]
364
- struct SledSetPolicyArgs {
364
+ struct SledSetArgs {
365
365
/// id of the sled
366
366
sled_id : SledOpt ,
367
367
368
- /// The policy to set for the sled
368
+ /// the command to set on the sled
369
+ #[ clap( subcommand) ]
370
+ command : SledSetCommand ,
371
+ }
372
+
373
+ #[ derive( Debug , Subcommand ) ]
374
+ enum SledSetCommand {
375
+ /// set the policy for this sled
376
+ Policy ( SledSetPolicyArgs ) ,
377
+ }
378
+
379
+ #[ derive( Debug , Args ) ]
380
+ struct SledSetPolicyArgs {
381
+ /// the policy to set
369
382
#[ clap( value_enum) ]
370
383
policy : SledPolicyOpt ,
371
384
}
@@ -1194,22 +1207,27 @@ fn cmd_sled_show(
1194
1207
Ok ( Some ( s) )
1195
1208
}
1196
1209
1197
- fn cmd_sled_set_policy (
1210
+ fn cmd_sled_set (
1198
1211
sim : & mut ReconfiguratorSim ,
1199
- args : SledSetPolicyArgs ,
1212
+ args : SledSetArgs ,
1200
1213
) -> anyhow:: Result < Option < String > > {
1201
1214
let mut state = sim. current_state ( ) . to_mut ( ) ;
1202
1215
let system = state. system_mut ( ) ;
1203
1216
let sled_id = args. sled_id . to_sled_id ( system. description ( ) ) ?;
1204
- system. description_mut ( ) . sled_set_policy ( sled_id, args. policy . into ( ) ) ?;
1205
- sim. commit_and_bump (
1206
- format ! (
1207
- "reconfigurator-cli sled-set-policy: {} to {}" ,
1208
- sled_id, args. policy,
1209
- ) ,
1210
- state,
1211
- ) ;
1212
- Ok ( Some ( format ! ( "set sled {} policy to {}" , sled_id, args. policy) ) )
1217
+
1218
+ match args. command {
1219
+ SledSetCommand :: Policy ( SledSetPolicyArgs { policy } ) => {
1220
+ system. description_mut ( ) . sled_set_policy ( sled_id, policy. into ( ) ) ?;
1221
+ sim. commit_and_bump (
1222
+ format ! (
1223
+ "reconfigurator-cli sled-set policy: {} to {}" ,
1224
+ sled_id, policy
1225
+ ) ,
1226
+ state,
1227
+ ) ;
1228
+ Ok ( Some ( format ! ( "set sled {sled_id} policy to {policy}" ) ) )
1229
+ }
1230
+ }
1213
1231
}
1214
1232
1215
1233
fn cmd_sled_update_install_dataset (
0 commit comments