From 6be90f420e820e9305c35529c2ffadc60f95fa5a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 27 Mar 2019 21:44:23 -0700 Subject: [PATCH] pkg/asset/machines/master: Rename (*Master).StructuredMachines -> Machines Since f2eacf323 (asset/machines/master: allow adding MachineConfigs for control-plane machinepool, 2019-03-25, #1150), we no longer need to filter a File slice to get a Master object's Machine files. Drop the obsoleted Machines() implemenation and rename the previous StructuredMachines implmentation to take its place. --- pkg/asset/cluster/tfvars.go | 9 ++++----- pkg/asset/machines/master.go | 13 ++----------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/pkg/asset/cluster/tfvars.go b/pkg/asset/cluster/tfvars.go index 9de5e8be5fa..246159f6bf1 100644 --- a/pkg/asset/cluster/tfvars.go +++ b/pkg/asset/cluster/tfvars.go @@ -83,8 +83,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error { bootstrapIgn := string(bootstrapIgnAsset.Files()[0].Data) masterIgn := string(masterIgnAsset.Files()[0].Data) - masters := mastersAsset.Machines() - masterCount := len(masters) + masterCount := len(mastersAsset.MachineFiles) data, err := tfvars.TFVars( clusterID.InfraID, installConfig.Config.ClusterDomain(), @@ -110,7 +109,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error { switch platform { case aws.Name: - masters, err := mastersAsset.StructuredMachines() + masters, err := mastersAsset.Machines() if err != nil { return err } @@ -127,7 +126,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error { Data: data, }) case libvirt.Name: - masters, err := mastersAsset.StructuredMachines() + masters, err := mastersAsset.Machines() if err != nil { return err } @@ -146,7 +145,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error { Data: data, }) case openstack.Name: - masters, err := mastersAsset.StructuredMachines() + masters, err := mastersAsset.Machines() if err != nil { return err } diff --git a/pkg/asset/machines/master.go b/pkg/asset/machines/master.go index 9b2f9e38608..fe28413de24 100644 --- a/pkg/asset/machines/master.go +++ b/pkg/asset/machines/master.go @@ -218,17 +218,8 @@ func (m *Master) Load(f asset.FileFetcher) (found bool, err error) { return true, nil } -// Machines returns master Machine manifest YAML. -func (m *Master) Machines() [][]byte { - machines := make([][]byte, len(m.MachineFiles)) - for i, file := range m.MachineFiles { - machines[i] = file.Data - } - return machines -} - -// StructuredMachines returns master Machine manifest structures. -func (m *Master) StructuredMachines() ([]machineapi.Machine, error) { +// Machines returns master Machine manifest structures. +func (m *Master) Machines() ([]machineapi.Machine, error) { scheme := runtime.NewScheme() awsapi.AddToScheme(scheme) libvirtapi.AddToScheme(scheme)