@@ -53,8 +53,9 @@ const (
5353)
5454
5555var (
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" )
5859)
5960
6061// PacketMachineReconciler reconciles a PacketMachine object
@@ -418,11 +419,11 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
418419 // If Metro or Facility has changed in the spec, verify that the facility's metro is compatible with the requested spec change.
419420
420421 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 )
422423 }
423424
424425 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 )
426427 }
427428
428429 return result , nil
0 commit comments