From 6f5e8fb6f6434fde3864fa6d471b2ebb6b908dec Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Thu, 28 Feb 2019 15:33:28 -0500 Subject: [PATCH] Fix machineClass migration --- cmd/clusterctl/phases/pivot.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) }