Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify platform openstack #35

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/build/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ func (b *Builder) writeModifyScript() error {
values := struct {
OutputImage string
CombustionDir string
Platform string
}{
OutputImage: b.generateOutputImageFilename(),
CombustionDir: b.combustionDir,
Platform: b.imageConfig.OperatingSystem.Platform,
}

writtenFilename, err := b.writeBuildDirFile(modifyScriptName, modifyRawImageScript, &values)
Expand Down
3 changes: 3 additions & 0 deletions pkg/build/scripts/modify-raw-image.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ set -euo pipefail
# - Resets the filesystem to read only

guestfish --rw -a {{.OutputImage}} -i <<'EOF'
download /boot/grub2/grub.cfg /tmp/grub.cfg
! sed -i 's/ignition.platform.id=metal/ignition.platform.id={{.Platform}}/' /tmp/grub.cfg
sh "btrfs property set / ro false"
upload /tmp/grub.cfg /boot/grub2/grub.cfg
copy-in {{.CombustionDir}} /
sh "btrfs filesystem label / INSTALL"
sh "btrfs property set / ro true"
Expand Down
9 changes: 7 additions & 2 deletions pkg/config/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ const (
)

type ImageConfig struct {
APIVersion string `yaml:"apiVersion"`
Image Image `yaml:"image"`
APIVersion string `yaml:"apiVersion"`
Image Image `yaml:"image"`
OperatingSystem OperatingSystem `yaml:"operatingSystem"`
}

type OperatingSystem struct {
Platform string `yaml:"platform"`
}

type Image struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/config/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestParse(t *testing.T) {
assert.Equal(t, "1.0", imageConfig.APIVersion)
assert.Equal(t, "iso", imageConfig.Image.ImageType)
assert.Equal(t, "slemicro5.5.iso", imageConfig.Image.BaseImage)
assert.Equal(t, "openstack", imageConfig.OperatingSystem.Platform)
assert.Equal(t, "eibimage.iso", imageConfig.Image.OutputImageName)
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/config/testdata/valid_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ image:
imageType: iso
baseImage: slemicro5.5.iso
outputImageName: eibimage.iso
operatingSystem:
platform: openstack