diff --git a/cmd/clusterctl/phases/pivot.go b/cmd/clusterctl/phases/pivot.go index 1ca23b409938..e54e6de48980 100644 --- a/cmd/clusterctl/phases/pivot.go +++ b/cmd/clusterctl/phases/pivot.go @@ -122,7 +122,7 @@ func pivot(from, to clusterclient.Client, providerComponents string) error { return err } - if err := deleteMachineClasses(from, to, machineClasses); err != nil { + if err := deleteMachineClasses(from, machineClasses); err != nil { return err } @@ -149,7 +149,7 @@ func moveClusters(from, to clusterclient.Client, clusters []*clusterv1.Cluster) return nil } -func deleteMachineClasses(from, to clusterclient.Client, machineClasses []*clusterv1.MachineClass) error { +func deleteMachineClasses(client clusterclient.Client, machineClasses []*clusterv1.MachineClass) error { machineClassNames := make([]string, 0, len(machineClasses)) for _, mc := range machineClasses { machineClassNames = append(machineClassNames, mc.Name) @@ -157,17 +157,17 @@ func deleteMachineClasses(from, to clusterclient.Client, machineClasses []*clust klog.V(4).Infof("Preparing to delete MachineClasses: %v", machineClassNames) for _, mc := range machineClasses { - if err := deleteMachineClass(from, to, mc); err != nil { + if err := deleteMachineClass(client, mc); err != nil { return errors.Wrapf(err, "failed to delete MachineClass %s:%s", mc.Namespace, mc.Name) } } return nil } -func deleteMachineClass(from, to clusterclient.Client, machineClass *clusterv1.MachineClass) error { +func deleteMachineClass(client clusterclient.Client, machineClass *clusterv1.MachineClass) error { // New objects cannot have a specified resource version. Clear it out. machineClass.SetResourceVersion("") - if err := to.DeleteMachineClass(machineClass.Namespace, machineClass.Name); err != nil { + if err := client.DeleteMachineClass(machineClass.Namespace, machineClass.Name); err != nil { return errors.Wrapf(err, "error deleting MachineClass %s/%s from source cluster", machineClass.Namespace, machineClass.Name) }