@@ -487,40 +487,34 @@ let generate_order ~(currents : Dev.t list) ~(rules : Rule.t list)
487
487
OrderedDev. assert_no_duplicate_mac new_order ;
488
488
new_order
489
489
490
- let generate ?(force = false ) interface_order =
491
- match interface_order with
492
- | None ->
493
- None
494
- | Some last_order ->
495
- let rules, last_order =
496
- match (last_order, force) with
497
- | [] , _ | _ :: _ , true ->
498
- (Rule. rules_of_file ~path: initial_rules_file_path, [] )
499
- | (_ :: _ as last_order ), false ->
500
- ([] , last_order)
501
- in
502
- let currents = Dev. get_all () in
503
- currents
504
- |> List. iter (fun x ->
505
- debug " %s current: %s" __FUNCTION__ (Dev. to_string x)
506
- ) ;
507
- let new_order = generate_order ~currents ~rules ~last_order in
508
- new_order
509
- |> List. iter (fun x ->
510
- debug " %s new order: %s" __FUNCTION__ (OrderedDev. to_string x)
511
- ) ;
512
-
513
- (* Find the NICs whose name changes *)
514
- let changes =
515
- let m = OrderedDev. map_by_position last_order in
516
- List. fold_left
517
- (fun acc {position; name = curr ; _} ->
518
- match IntMap. find_opt position m with
519
- | Some {name = last ; _} when last <> curr ->
520
- (last, curr) :: acc
521
- | _ ->
522
- acc
523
- )
524
- [] new_order
525
- in
526
- Some (new_order, changes)
490
+ let generate ?(force = false ) last_order =
491
+ let rules, last_order =
492
+ match (last_order, force) with
493
+ | [] , _ | _ :: _ , true ->
494
+ (Rule. rules_of_file ~path: initial_rules_file_path, [] )
495
+ | (_ :: _ as last_order ), false ->
496
+ ([] , last_order)
497
+ in
498
+ let currents = Dev. get_all () in
499
+ currents
500
+ |> List. iter (fun x -> debug " %s current: %s" __FUNCTION__ (Dev. to_string x)) ;
501
+ let new_order = generate_order ~currents ~rules ~last_order in
502
+ new_order
503
+ |> List. iter (fun x ->
504
+ debug " %s new order: %s" __FUNCTION__ (OrderedDev. to_string x)
505
+ ) ;
506
+
507
+ (* Find the NICs whose name changes *)
508
+ let changes =
509
+ let m = OrderedDev. map_by_position last_order in
510
+ List. fold_left
511
+ (fun acc {position; name = curr ; _} ->
512
+ match IntMap. find_opt position m with
513
+ | Some {name = last ; _} when last <> curr ->
514
+ (last, curr) :: acc
515
+ | _ ->
516
+ acc
517
+ )
518
+ [] new_order
519
+ in
520
+ (new_order, changes)
0 commit comments