Skip to content

Commit 6d4c461

Browse files
committed
fix golangci-lint
1 parent 06c860c commit 6d4c461

File tree

2 files changed

+4
-59
lines changed

2 files changed

+4
-59
lines changed

internal/services/baremetal/server.go

+4-57
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
78
"github.com/hashicorp/go-cty/cty"
89
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
910
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
@@ -336,6 +337,9 @@ func ResourceServerCreate(ctx context.Context, d *schema.ResourceData, m interfa
336337
if file != "" {
337338
todecode, _ := file.(string)
338339
err = json.Unmarshal([]byte(todecode), &partitioningSchema)
340+
if err != nil {
341+
return diag.FromErr(err)
342+
}
339343
}
340344
req.Install = &baremetal.CreateServerRequestInstall{
341345
OsID: zonal.ExpandID(d.Get("os")).ID,
@@ -487,63 +491,6 @@ func ResourceServerRead(ctx context.Context, d *schema.ResourceData, m interface
487491
return nil
488492
}
489493

490-
//func schemaToStringList(schema *baremetal.Schema) string {
491-
// var result string
492-
//
493-
// if schema.Disks != nil {
494-
// for _, disk := range schema.Disks {
495-
// if disk != nil {
496-
// result += "Disk: " + disk.Device
497-
// if disk.Partitions != nil {
498-
// for _, partition := range disk.Partitions {
499-
// if partition != nil {
500-
// result += fmt.Sprintf(" Partition: %s Number: %d Size: %s", partition.Label, partition.Number, partition.Size.String())
501-
// }
502-
// }
503-
// }
504-
// }
505-
// }
506-
// }
507-
//
508-
// if schema.Raids != nil {
509-
// for _, raid := range schema.Raids {
510-
// if raid != nil {
511-
// result += fmt.Sprintf("RAID: %s Level: %s", raid.Name, raid.Level)
512-
// for _, device := range raid.Devices {
513-
// result += " Device: " + device
514-
// }
515-
// }
516-
// }
517-
// }
518-
//
519-
// if schema.Filesystems != nil {
520-
// for _, fs := range schema.Filesystems {
521-
// if fs != nil {
522-
// result += fmt.Sprintf("Filesystem: %s Format: %s Mountpoint: %s", fs.Device, fs.Format, fs.Mountpoint)
523-
// }
524-
// }
525-
// }
526-
//
527-
// if schema.Zfs != nil {
528-
// for _, pool := range schema.Zfs.Pools {
529-
// if pool != nil {
530-
// result += fmt.Sprintf("ZFS Pool: %s Type: %s", pool.Name, pool.Type)
531-
// for _, device := range pool.Devices {
532-
// result += " Device: " + device
533-
// }
534-
// for _, option := range pool.Options {
535-
// result += " Option: " + option
536-
// }
537-
// for _, fsOption := range pool.FilesystemOptions {
538-
// result += " Filesystem Option: " + fsOption
539-
// }
540-
// }
541-
// }
542-
// }
543-
//
544-
// return result
545-
//}
546-
547494
//gocyclo:ignore
548495
func ResourceServerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
549496
api, zonedID, err := NewAPIWithZoneAndID(m, d.Id())

internal/services/baremetal/server_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ func TestAccServer_CreateServerWithCustomInstallConfig(t *testing.T) {
185185

186186
SSHKeyName := "TestAccServer_CreateServerWithCustomInstallConfig"
187187
name := "TestAccServer_CreateServerWithCustomInstallConfig"
188-
//fileName := "partitioning.json"
189188

190189
resource.ParallelTest(t, resource.TestCase{
191190
PreCheck: func() { acctest.PreCheck(t) },
@@ -1076,7 +1075,6 @@ func testAccChechPartitioning(tt *acctest.TestTools, n string, source string) re
10761075
return fmt.Errorf("server %s has no partitioning schema", n)
10771076
}
10781077
schema := baremetalSDK.Schema{}
1079-
//partitioning, _ := json.Marshal(source)
10801078
err = json.Unmarshal([]byte(source), &schema)
10811079
if err != nil {
10821080
return err

0 commit comments

Comments
 (0)