mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 10:33:46 +00:00
misc(vm): fix CustomBool conversion bug introduced in acl
implementation (#1286)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
78f9d6e2bf
commit
920a4cd415
@ -72,7 +72,7 @@ func (r *aclResourceModel) intoUpdateBody() *access.ACLUpdateRequestBody {
|
||||
body := &access.ACLUpdateRequestBody{
|
||||
Groups: nil,
|
||||
Path: r.Path,
|
||||
Propagate: proxmoxtypes.CustomBoolPtr(r.Propagate),
|
||||
Propagate: proxmoxtypes.CustomBool(r.Propagate).Pointer(),
|
||||
Roles: []string{r.RoleID},
|
||||
Tokens: nil,
|
||||
Users: nil,
|
||||
|
@ -144,7 +144,7 @@ func (r *userTokenResource) Create(ctx context.Context, req resource.CreateReque
|
||||
|
||||
body := access.UserTokenCreateRequestBody{
|
||||
Comment: plan.Comment.ValueStringPointer(),
|
||||
PrivSeparate: proxmoxtypes.CustomBoolPtr(plan.PrivSeparation.ValueBool()),
|
||||
PrivSeparate: proxmoxtypes.CustomBoolPtr(plan.PrivSeparation.ValueBoolPointer()),
|
||||
}
|
||||
|
||||
if !plan.ExpirationDate.IsNull() && plan.ExpirationDate.ValueString() != "" {
|
||||
@ -215,7 +215,7 @@ func (r *userTokenResource) Update(ctx context.Context, req resource.UpdateReque
|
||||
|
||||
body := access.UserTokenUpdateRequestBody{
|
||||
Comment: plan.Comment.ValueStringPointer(),
|
||||
PrivSeparate: proxmoxtypes.CustomBoolPtr(plan.PrivSeparation.ValueBool()),
|
||||
PrivSeparate: proxmoxtypes.CustomBoolPtr(plan.PrivSeparation.ValueBoolPointer()),
|
||||
}
|
||||
|
||||
if !plan.ExpirationDate.IsNull() && plan.ExpirationDate.ValueString() != "" {
|
||||
|
@ -137,7 +137,7 @@ func (r *vmResource) create(ctx context.Context, plan vmModel, diags *diag.Diagn
|
||||
Description: plan.Description.ValueStringPointer(),
|
||||
Name: plan.Name.ValueStringPointer(),
|
||||
Tags: plan.Tags.ValueStringPointer(ctx, diags),
|
||||
Template: proxmoxtypes.CustomBoolPtr(plan.Template.ValueBool()),
|
||||
Template: proxmoxtypes.CustomBoolPtr(plan.Template.ValueBoolPointer()),
|
||||
VMID: int(plan.ID.ValueInt64()),
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,9 @@ func TestCustomStorageDevice_UnmarshalJSON(t *testing.T) {
|
||||
Discard: ptr.Ptr("on"),
|
||||
Enabled: true,
|
||||
FileVolume: "local-lvm:vm-2041-disk-0",
|
||||
IOThread: types.CustomBoolPtr(true),
|
||||
IOThread: types.CustomBool(true).Pointer(),
|
||||
Size: ds8gig,
|
||||
SSD: types.CustomBoolPtr(true),
|
||||
SSD: types.CustomBool(true).Pointer(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -47,9 +47,9 @@ func TestCustomStorageDevice_UnmarshalJSON(t *testing.T) {
|
||||
Enabled: true,
|
||||
FileVolume: "nfs:2041/vm-2041-disk-0.raw",
|
||||
Format: ptr.Ptr("raw"),
|
||||
IOThread: types.CustomBoolPtr(true),
|
||||
IOThread: types.CustomBool(true).Pointer(),
|
||||
Size: ds8gig,
|
||||
SSD: types.CustomBoolPtr(true),
|
||||
SSD: types.CustomBool(true).Pointer(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -240,10 +240,10 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) {
|
||||
want: &CustomPCIDevice{
|
||||
DeviceIDs: &[]string{"81:00.4"},
|
||||
MDev: nil,
|
||||
PCIExpress: types.CustomBoolPtr(false),
|
||||
ROMBAR: types.CustomBoolPtr(true),
|
||||
PCIExpress: types.CustomBool(false).Pointer(),
|
||||
ROMBAR: types.CustomBool(true).Pointer(),
|
||||
ROMFile: nil,
|
||||
XVGA: types.CustomBoolPtr(false),
|
||||
XVGA: types.CustomBool(false).Pointer(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -253,10 +253,10 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) {
|
||||
DeviceIDs: nil,
|
||||
Mapping: ptr.Ptr("mappeddevice"),
|
||||
MDev: nil,
|
||||
PCIExpress: types.CustomBoolPtr(false),
|
||||
ROMBAR: types.CustomBoolPtr(true),
|
||||
PCIExpress: types.CustomBool(false).Pointer(),
|
||||
ROMBAR: types.CustomBool(true).Pointer(),
|
||||
ROMFile: nil,
|
||||
XVGA: types.CustomBoolPtr(false),
|
||||
XVGA: types.CustomBool(false).Pointer(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -337,7 +337,7 @@ func TestCustomUSBDevice_UnmarshalJSON(t *testing.T) {
|
||||
line: `"host=81:00,usb3=0"`,
|
||||
want: &CustomUSBDevice{
|
||||
HostDevice: ptr.Ptr("81:00"),
|
||||
USB3: types.CustomBoolPtr(false),
|
||||
USB3: types.CustomBool(false).Pointer(),
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -346,7 +346,7 @@ func TestCustomUSBDevice_UnmarshalJSON(t *testing.T) {
|
||||
want: &CustomUSBDevice{
|
||||
HostDevice: nil,
|
||||
Mapping: ptr.Ptr("mappeddevice"),
|
||||
USB3: types.CustomBoolPtr(false),
|
||||
USB3: types.CustomBool(false).Pointer(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -41,8 +41,12 @@ type CustomPrivileges []string
|
||||
type CustomTimestamp time.Time
|
||||
|
||||
// CustomBoolPtr creates a pointer to a CustomBool.
|
||||
func CustomBoolPtr(b bool) *CustomBool {
|
||||
return ptr.Ptr(CustomBool(b))
|
||||
func CustomBoolPtr(b *bool) *CustomBool {
|
||||
if b == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return ptr.Ptr(CustomBool(*b))
|
||||
}
|
||||
|
||||
// MarshalJSON converts a boolean to a JSON value.
|
||||
|
Loading…
Reference in New Issue
Block a user