@@ -53,8 +53,9 @@ const (
53
53
)
54
54
55
55
var (
56
- ErrMissingDevice = errors .New ("machine does not exist" )
57
- ErrFacilityMetroMatch = errors .New ("instance facility does not match machine facility" )
56
+ ErrMissingDevice = errors .New ("machine does not exist" )
57
+ ErrFacilityMatch = errors .New ("instance facility does not match machine facility" )
58
+ ErrMetroMatch = errors .New ("instance metro does not match machine metro" )
58
59
)
59
60
60
61
// PacketMachineReconciler reconciles a PacketMachine object
@@ -418,11 +419,11 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
418
419
// If Metro or Facility has changed in the spec, verify that the facility's metro is compatible with the requested spec change.
419
420
420
421
if machineScope .PacketMachine .Spec .Facility != "" && machineScope .PacketMachine .Spec .Facility != dev .Facility .Code {
421
- return ctrl.Result {}, fmt .Errorf ("%w: %s != %s" , ErrFacilityMetroMatch , machineScope .PacketMachine .Spec .Facility , dev .Facility .Code )
422
+ return ctrl.Result {}, fmt .Errorf ("%w: %s != %s" , ErrFacilityMatch , machineScope .PacketMachine .Spec .Facility , dev .Facility .Code )
422
423
}
423
424
424
425
if machineScope .PacketMachine .Spec .Metro != "" && machineScope .PacketMachine .Spec .Metro != dev .Metro .Code {
425
- return ctrl.Result {}, fmt .Errorf ("instance metro does not match machine metro %s: %w " , machineScope .Name (), err )
426
+ return ctrl.Result {}, fmt .Errorf ("%w: %s != %s " , ErrMetroMatch , machineScope .PacketMachine . Spec . Facility , dev . Facility . Code )
426
427
}
427
428
428
429
return result , nil
0 commit comments