diff --git a/.golangci.yml b/.golangci.yml index a020fd9..1ca9442 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,6 +7,8 @@ linters-settings: local-prefixes: github.com/metal-toolbox/fleetdb gofumpt: extra-rules: true + stylecheck: + checks: ["all", "-ST1000"] linters: enable: diff --git a/internal/inventory/attribute_utils.go b/internal/inventory/attribute_utils.go index 90d58de..489942c 100644 --- a/internal/inventory/attribute_utils.go +++ b/internal/inventory/attribute_utils.go @@ -5,11 +5,12 @@ import ( "database/sql" "encoding/json" - "github.com/metal-toolbox/fleetdb/internal/models" "github.com/volatiletech/null/v8" "github.com/volatiletech/sqlboiler/v4/boil" "github.com/volatiletech/sqlboiler/v4/queries/qm" "github.com/volatiletech/sqlboiler/v4/types" + + "github.com/metal-toolbox/fleetdb/internal/models" ) // the "either server or server-component" facet of attributes makes this function a diff --git a/internal/inventory/component_attributes.go b/internal/inventory/component_attributes.go index bc017c0..4992d4b 100644 --- a/internal/inventory/component_attributes.go +++ b/internal/inventory/component_attributes.go @@ -1,4 +1,3 @@ -//nolint:all // XXX remove this! package inventory import ( diff --git a/internal/inventory/device_components.go b/internal/inventory/device_components.go index c4fd6a1..4779dca 100644 --- a/internal/inventory/device_components.go +++ b/internal/inventory/device_components.go @@ -1,4 +1,3 @@ -//nolint:all // XXX remove this! package inventory import ( @@ -6,13 +5,14 @@ import ( "database/sql" "github.com/bmc-toolbox/common" - "github.com/metal-toolbox/fleetdb/internal/dbtools" - "github.com/metal-toolbox/fleetdb/internal/models" rivets "github.com/metal-toolbox/rivets/types" "github.com/pkg/errors" "github.com/volatiletech/null/v8" "github.com/volatiletech/sqlboiler/v4/boil" "github.com/volatiletech/sqlboiler/v4/queries/qm" + + "github.com/metal-toolbox/fleetdb/internal/dbtools" + "github.com/metal-toolbox/fleetdb/internal/models" ) var ( @@ -198,7 +198,6 @@ func retrieveComponentStatusVA(ctx context.Context, exec boil.ContextExecutor, p func componentsFromDatabase(ctx context.Context, exec boil.ContextExecutor, inband bool, deviceID string) ([]*rivets.Component, error) { records, err := models.ServerComponents( - //models.ServerComponentWhere.Name.EQ(null.StringFrom(slug)), models.ServerComponentWhere.ServerID.EQ(deviceID), qm.OrderBy(models.ServerComponentColumns.CreatedAt+" DESC"), ).All(ctx, exec) diff --git a/internal/inventory/device_view.go b/internal/inventory/device_view.go index 8de5ae8..34af27f 100644 --- a/internal/inventory/device_view.go +++ b/internal/inventory/device_view.go @@ -1,4 +1,3 @@ -//nolint:all // XXX remove this! package inventory import ( @@ -6,13 +5,14 @@ import ( "encoding/json" "github.com/google/uuid" - "github.com/metal-toolbox/fleetdb/internal/dbtools" - "github.com/metal-toolbox/fleetdb/internal/models" rivets "github.com/metal-toolbox/rivets/types" "github.com/pkg/errors" "github.com/volatiletech/null/v8" "github.com/volatiletech/sqlboiler/v4/boil" "github.com/volatiletech/sqlboiler/v4/queries/qm" + + "github.com/metal-toolbox/fleetdb/internal/dbtools" + "github.com/metal-toolbox/fleetdb/internal/models" ) /* @@ -32,20 +32,21 @@ var ( // historically these values were determined/set by alloy, even though they are // internal to the data storage layer, hence the names alloyVendorNamespace = "sh.hollow.alloy.server_vendor_attributes" - //alloyMetadataNamespace = "sh.hollow.alloy.server_metadata_attributes" - //alloyUefiVarsNamespace = "sh.hollow.alloy.server_uefi_variables" // this is a versioned attribute, we expect it to change + // XXX: enable this when Server supports UEFI variables + // alloyUefiVarsNamespace = "sh.hollow.alloy.server_uefi_variables" // this is a versioned attribute, we expect it to change serverStatusNamespace = "sh.hollow.alloy.server_status" // versioned // metadata keys modelKey = "model" vendorKey = "vendor" serialKey = "serial" - //uefiVarsKey = "uefi-variables" + // XXX: again, enable after UEFI Variables are a thing. uefiVarsKey = "uefi-variables" errBadServer = errors.New("data is missing required field") errBadComponent = errors.New("component data") ) +// DeviceView encapsulates everything we need to get and set inventory data for servers // A reminder for maintenance: this type needs to be able to contain all the // relevant fields from Component-Inventory or Alloy. type DeviceView struct {