Skip to content

Commit

Permalink
Merge pull request #261 from chrisbenincasa/260
Browse files Browse the repository at this point in the history
Fix POST /nodes/{node}/lxc/{id}/template (#260)
  • Loading branch information
mleone87 authored May 14, 2023
2 parents 62dbebe + 90253b9 commit 23ba4a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion proxmox/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ func (c *Client) CreateTemplate(vmr *VmRef) error {
return err
}

if exitStatus != "OK" {
// Specifically ignore empty exit status for LXCs, since they don't return a task ID
// when creating templates in the first place (but still successfully create them).
if exitStatus != "OK" && vmr.vmType != "lxc" {
return errors.New("Can't convert Vm to template:" + exitStatus)
}

Expand Down
13 changes: 13 additions & 0 deletions test/api/Lxc/lxc_create_update_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,16 @@ func Test_Remove_Lxc_Container(t *testing.T) {

require.NoError(t, err)
}

func Test_Create_Template_Lxc_Container(t *testing.T) {
Test := api_test.Test{}
_ = Test.CreateTest()
config := _create_lxc_spec(true)

vmRef := _create_vmref()
err := config.CreateLxc(vmRef, Test.GetClient())
require.NoError(t, err)

err = Test.GetClient().CreateTemplate(vmRef)
require.NoError(t, err)
}

0 comments on commit 23ba4a4

Please sign in to comment.