Skip to content

Commit

Permalink
pkg/asset/machines/master: Rename (*Master).StructuredMachines -> Mac…
Browse files Browse the repository at this point in the history
…hines

Since f2eacf3 (asset/machines/master: allow adding MachineConfigs
for control-plane machinepool, 2019-03-25, openshift#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.
  • Loading branch information
wking authored and vrutkovs committed Apr 1, 2019
1 parent 0ee9826 commit 260b85c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
9 changes: 4 additions & 5 deletions pkg/asset/cluster/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
13 changes: 2 additions & 11 deletions pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 260b85c

Please sign in to comment.