diff --git a/pkg/machine/applehv/machine.go b/pkg/machine/applehv/machine.go index 44960e26ca..91feb8e29a 100644 --- a/pkg/machine/applehv/machine.go +++ b/pkg/machine/applehv/machine.go @@ -259,7 +259,8 @@ func (m *MacMachine) Init(opts machine.InitOptions) (bool, error) { }) if len(opts.IgnitionPath) > 0 { - return false, builder.BuildWithIgnitionFile(opts.IgnitionPath) + err = builder.BuildWithIgnitionFile(opts.IgnitionPath) + return false, err } if err := builder.GenerateIgnitionConfig(); err != nil { diff --git a/pkg/machine/e2e/init_test.go b/pkg/machine/e2e/init_test.go index c6bb379ad8..27b0b3d060 100644 --- a/pkg/machine/e2e/init_test.go +++ b/pkg/machine/e2e/init_test.go @@ -313,20 +313,21 @@ var _ = Describe("podman machine init", func() { Expect(err).ToNot(HaveOccurred()) Expect(ec).To(Equal(125)) - // Clashing keys - init fails - i = new(initMachine) - session, err = mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run() - Expect(err).ToNot(HaveOccurred()) - Expect(session).To(Exit(125)) - - // ensure files created by init are cleaned up on init failure - _, err = os.Stat(img) - Expect(err).To(HaveOccurred()) - _, err = os.Stat(cfgpth) - Expect(err).To(HaveOccurred()) - // WSL does not use ignition if testProvider.VMType() != define.WSLVirt { + // Bad ignition path - init fails + i = new(initMachine) + i.ignitionPath = "/bad/path" + session, err = mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run() + Expect(err).ToNot(HaveOccurred()) + Expect(session).To(Exit(125)) + + // ensure files created by init are cleaned up on init failure + _, err = os.Stat(img) + Expect(err).To(HaveOccurred()) + _, err = os.Stat(cfgpth) + Expect(err).To(HaveOccurred()) + _, err = os.Stat(ign) Expect(err).To(HaveOccurred()) } diff --git a/pkg/machine/hyperv/machine.go b/pkg/machine/hyperv/machine.go index f2d4c0b3a6..ea8d522144 100644 --- a/pkg/machine/hyperv/machine.go +++ b/pkg/machine/hyperv/machine.go @@ -232,7 +232,8 @@ func (m *HyperVMachine) Init(opts machine.InitOptions) (bool, error) { // If the user provides an ignition file, we need to // copy it into the conf dir if len(opts.IgnitionPath) > 0 { - return false, builder.BuildWithIgnitionFile(opts.IgnitionPath) + err = builder.BuildWithIgnitionFile(opts.IgnitionPath) + return false, err } callbackFuncs.Add(m.IgnitionFile.Delete) diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index f06b02f30c..14ab01d790 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -205,7 +205,8 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) { // If the user provides an ignition file, we need to // copy it into the conf dir if len(opts.IgnitionPath) > 0 { - return false, builder.BuildWithIgnitionFile(opts.IgnitionPath) + err = builder.BuildWithIgnitionFile(opts.IgnitionPath) + return false, err } if err := builder.GenerateIgnitionConfig(); err != nil {