diff options
author | Flavio Castelli <fcastelli@suse.com> | 2016-09-08 14:21:50 +0200 |
---|---|---|
committer | Flavio Castelli <fcastelli@suse.com> | 2016-09-08 14:21:50 +0200 |
commit | fdd13354ef6a19b0d75cb9f8e395239a2af86317 (patch) | |
tree | 02cebb419ea7d9b4dfe0cff327ae5ae661f8c570 /libvirt/cloudinit_def.go | |
parent | 58c2e48a2848750f698ce1aa7f299e182246e8af (diff) | |
download | terraform-provider-libvirt-fdd13354ef6a19b0d75cb9f8e395239a2af86317.tar terraform-provider-libvirt-fdd13354ef6a19b0d75cb9f8e395239a2af86317.tar.gz |
Make cloudinit generation more resilent
Invoke the external `genisofs` program in a safer way.
Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Diffstat (limited to 'libvirt/cloudinit_def.go')
-rw-r--r-- | libvirt/cloudinit_def.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libvirt/cloudinit_def.go b/libvirt/cloudinit_def.go index 6e3c375b..1712e067 100644 --- a/libvirt/cloudinit_def.go +++ b/libvirt/cloudinit_def.go @@ -96,7 +96,7 @@ func (ci *defCloudInit) CreateAndUpload(virConn *libvirt.VirConnection) (string, // create the volume volume, err := pool.StorageVolCreateXML(string(volumeDefXml), 0) if err != nil { - return "", fmt.Errorf("Error creating libvirt volume: %s", err) + return "", fmt.Errorf("Error creating libvirt volume for cloudinit device %s: %s", ci.Name, err) } defer volume.Free() @@ -158,12 +158,9 @@ func (ci *defCloudInit) createISO() (string, error) { filepath.Join(tmpDir, METADATA)) log.Print("About to execute cmd: %+v", cmd) - if err = cmd.Start(); err != nil { + if err = cmd.Run(); err != nil { return "", fmt.Errorf("Error while starting the creation of CloudInit's ISO image: %s", err) } - if err = cmd.Wait(); err != nil { - return "", fmt.Errorf("Error while creating CloudInit's ISO image: %s", err) - } log.Print("ISO created at %s", isoDestination) return isoDestination, nil |