0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 10:33:46 +00:00

fix(network): fix linting issues and pending dupl directive

Signed-off-by: fmendieta <fmendieta@eservicios.indra.es>
This commit is contained in:
fmendieta 2025-06-19 10:03:58 +02:00
parent 4fb0587b35
commit 782998642e
2 changed files with 18 additions and 4 deletions

View File

@ -294,14 +294,18 @@ func (r *linuxBridgeResource) Create(ctx context.Context, req resource.CreateReq
if resp.Diagnostics.HasError() { if resp.Diagnostics.HasError() {
return return
} }
if !found { if !found {
resp.Diagnostics.AddError( resp.Diagnostics.AddError(
"Linux Bridge interface not found after creation", "Linux Bridge interface not found after creation",
fmt.Sprintf("Interface %q on node %q could not be read after creation", plan.Name.ValueString(), plan.NodeName.ValueString()), fmt.Sprintf(
"Interface %q on node %q could not be read after creation",
plan.Name.ValueString(), plan.NodeName.ValueString()),
) )
return return
} }
resp.State.Set(ctx, plan) resp.State.Set(ctx, plan)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
@ -343,6 +347,7 @@ func (r *linuxBridgeResource) read(ctx context.Context, model *linuxBridgeResour
return true return true
} }
return false return false
} }
@ -362,6 +367,7 @@ func (r *linuxBridgeResource) Read(ctx context.Context, req resource.ReadRequest
if resp.Diagnostics.HasError() { if resp.Diagnostics.HasError() {
return return
} }
if !found { if !found {
resp.State.RemoveResource(ctx) resp.State.RemoveResource(ctx)
return return
@ -430,7 +436,9 @@ func (r *linuxBridgeResource) Update(ctx context.Context, req resource.UpdateReq
if !found { if !found {
resp.Diagnostics.AddError( resp.Diagnostics.AddError(
"Linux Bridge interface not found after update", "Linux Bridge interface not found after update",
fmt.Sprintf("Interface %q on node %q could not be read after update", plan.Name.ValueString(), plan.NodeName.ValueString()), fmt.Sprintf(
"Interface %q on node %q could not be read after update",
plan.Name.ValueString(), plan.NodeName.ValueString()),
) )
return return
@ -526,6 +534,7 @@ func (r *linuxBridgeResource) ImportState(
return return
} }
diags := resp.State.Set(ctx, state) diags := resp.State.Set(ctx, state)
resp.Diagnostics.Append(diags...) resp.Diagnostics.Append(diags...)
} }

View File

@ -270,7 +270,9 @@ func (r *linuxVLANResource) Create(ctx context.Context, req resource.CreateReque
if !found { if !found {
resp.Diagnostics.AddError( resp.Diagnostics.AddError(
"Linux VLAN interface not found after creation", "Linux VLAN interface not found after creation",
fmt.Sprintf("Interface %q on node %q could not be read after creation", plan.Name.ValueString(), plan.NodeName.ValueString()), fmt.Sprintf(
"Interface %q on node %q could not be read after creation",
plan.Name.ValueString(), plan.NodeName.ValueString()),
) )
return return
@ -309,6 +311,7 @@ func (r *linuxVLANResource) read(ctx context.Context, model *linuxVLANResourceMo
return true return true
} }
return false return false
} }
@ -381,7 +384,9 @@ func (r *linuxVLANResource) Update(ctx context.Context, req resource.UpdateReque
if !found { if !found {
resp.Diagnostics.AddError( resp.Diagnostics.AddError(
"Linux VLAN interface not found after update", "Linux VLAN interface not found after update",
fmt.Sprintf("Interface %q on node %q could not be read after update", plan.Name.ValueString(), plan.NodeName.ValueString()), fmt.Sprintf(
"Interface %q on node %q could not be read after update",
plan.Name.ValueString(), plan.NodeName.ValueString()),
) )
return return