Skip to content

Commit

Permalink
Merge pull request Telmate#121 from claudusd/clone_error
Browse files Browse the repository at this point in the history
Do not create resource when clone fail
  • Loading branch information
ggongaware committed Feb 5, 2020
2 parents 7fa28b0 + 08df920 commit 4403acf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,13 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
}
log.Print("[DEBUG] cloning VM")
err = config.CloneVm(sourceVmr, vmr, client)

if err != nil {
pmParallelEnd(pconf)
return err
}

err = config.UpdateConfig(vmr, client)
if err != nil {
// Set the id because when update config fail the vm is still created
d.SetId(resourceId(targetNode, "qemu", vmr.VmId()))
Expand Down

0 comments on commit 4403acf

Please sign in to comment.