Skip to content

Commit 9810f30

Browse files
committed
baremetal: remove stages
1 parent 9ec014b commit 9810f30

File tree

12 files changed

+66
-296
lines changed

12 files changed

+66
-296
lines changed

data/data/baremetal/OWNERS

Lines changed: 0 additions & 7 deletions
This file was deleted.

data/data/baremetal/bootstrap/README.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

data/data/baremetal/bootstrap/main.tf

Lines changed: 0 additions & 66 deletions
This file was deleted.

data/data/baremetal/variables-baremetal.tf

Lines changed: 0 additions & 14 deletions
This file was deleted.

pkg/infrastructure/baremetal/baremetal.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,44 @@ import (
99
"github.com/openshift/installer/pkg/types"
1010
)
1111

12+
// Provider is the baremetal platform provider.
1213
type Provider struct{}
1314

15+
// InitializeProvider initializes an empty Provider.
1416
func InitializeProvider() infrastructure.Provider {
1517
return Provider{}
1618
}
1719

1820
// Provision creates a baremetal platform bootstrap node.
1921
func (a Provider) Provision(ctx context.Context, dir string, parents asset.Parents) ([]*asset.File, error) {
20-
config, err := GetConfig(dir)
22+
config, err := getConfig(dir)
2123
if err != nil {
22-
return []*asset.File{}, fmt.Errorf("failed to get baremetal platform config: %v", err)
24+
return []*asset.File{}, fmt.Errorf("failed to get baremetal platform config: %w", err)
2325
}
2426

2527
err = createBootstrap(config)
2628
if err != nil {
27-
return []*asset.File{}, fmt.Errorf("failed to create bootstrap: %v", err)
29+
return []*asset.File{}, fmt.Errorf("failed to create bootstrap: %w", err)
2830
}
2931

3032
return []*asset.File{}, nil
3133
}
3234

35+
// DestroyBootstrap destroys the temporary bootstrap resources.
3336
func (a Provider) DestroyBootstrap(dir string) error {
34-
config, err := GetConfig(dir)
37+
config, err := getConfig(dir)
3538
if err != nil {
36-
return fmt.Errorf("failed to get baremetal platform config: %v", err)
39+
return fmt.Errorf("failed to get baremetal platform config: %w", err)
3740
}
3841
err = destroyBootstrap(config)
3942
if err != nil {
40-
return fmt.Errorf("failed to create bootstrap: %v", err)
43+
return fmt.Errorf("failed to create bootstrap: %w", err)
4144
}
4245

4346
return nil
4447
}
4548

49+
// ExtractHostAddresses extracts the IPs of the bootstrap and control plane machines.
4650
func (a Provider) ExtractHostAddresses(dir string, ic *types.InstallConfig, ha *infrastructure.HostAddresses) error {
4751
ha.Bootstrap = ic.Platform.BareMetal.BootstrapProvisioningIP
4852

pkg/infrastructure/baremetal/bootstrap.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/digitalocean/go-libvirt"
1111
"github.com/sirupsen/logrus"
12-
1312
"libvirt.org/go/libvirtxml"
1413
)
1514

pkg/infrastructure/baremetal/ignition.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ type defIgnition struct {
1818
func (ign *defIgnition) createFile() (string, error) {
1919
tempFile, err := os.CreateTemp("", ign.Name)
2020
if err != nil {
21-
return "", fmt.Errorf("Error creating tmp file: %v", err)
21+
return "", fmt.Errorf("error creating tmp file: %w", err)
2222
}
2323
defer tempFile.Close()
2424

2525
if _, err := tempFile.WriteString(ign.Content); err != nil {
26-
return "", fmt.Errorf("Cannot write Ignition object to temporary " +
26+
return "", fmt.Errorf("cannot write Ignition object to temporary " +
2727
"ignition file")
2828
}
2929

@@ -38,7 +38,7 @@ func (ign *defIgnition) CreateAndUpload(client *libvirt.Libvirt) (string, error)
3838

3939
err = client.StoragePoolRefresh(pool, 0)
4040
if err != nil {
41-
return "", fmt.Errorf("failed to refresh pool %v", err)
41+
return "", fmt.Errorf("failed to refresh pool %w", err)
4242
}
4343

4444
volumeDef := newVolume(ign.Name)
@@ -49,7 +49,7 @@ func (ign *defIgnition) CreateAndUpload(client *libvirt.Libvirt) (string, error)
4949
}
5050
defer func() {
5151
if err = os.Remove(ignFile); err != nil {
52-
logrus.Errorf("Error while removing tmp Ignition file: %v", err)
52+
logrus.Errorf("error while removing tmp Ignition file: %s", err)
5353
}
5454
}()
5555

@@ -69,17 +69,17 @@ func (ign *defIgnition) CreateAndUpload(client *libvirt.Libvirt) (string, error)
6969

7070
volumeDefXML, err := xml.Marshal(volumeDef)
7171
if err != nil {
72-
return "", fmt.Errorf("Error serializing libvirt volume: %s", err)
72+
return "", fmt.Errorf("error serializing libvirt volume: %w", err)
7373
}
7474

7575
volume, err := client.StorageVolCreateXML(pool, string(volumeDefXML), 0)
7676
if err != nil {
77-
return "", fmt.Errorf("Error creating libvirt volume for Ignition %s: %s", ign.Name, err)
77+
return "", fmt.Errorf("error creating libvirt volume for Ignition %s: %w", ign.Name, err)
7878
}
7979

8080
err = img.Import(newCopier(client, volume, volumeDef.Capacity.Value), volumeDef)
8181
if err != nil {
82-
return "", fmt.Errorf("Error while uploading ignition file %s: %s", img.String(), err)
82+
return "", fmt.Errorf("error while uploading ignition file %s: %w", img.String(), err)
8383
}
8484

8585
return "", nil

0 commit comments

Comments
 (0)