Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
queue_rules:
- name: default
conditions:
# Conditions to get out of the queue (= merged)
- check-success=lint
- check-success=test

pull_request_rules:
- name: Automatic merge on approval
conditions:
queue_conditions:
- base=master
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
- check-success=lint
- check-success=test
- label!=do-not-merge
- label=ready-to-merge
merge_conditions:
# Conditions to get out of the queue (= merged)
- check-success=lint
- check-success=test
commit_message_template: |
{{ title }} (#{{ number }})
merge_method: merge

pull_request_rules:
- name: Automatic merge on approval
conditions: []
actions:
queue:
method: merge
name: default
commit_message_template: |
{{ title }} (#{{ number }})

2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version-file: go.mod
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
14 changes: 7 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ linters-settings:
# TODO: enable and fix struct alignments
#enable:
# - fieldalignment
check-shadowing: true
settings:
printf:
funcs:
Expand Down Expand Up @@ -62,11 +61,12 @@ linters:
# additional linters
- bodyclose
- gocritic
- goerr113
- err113
- goimports
- gomnd
- mnd
- misspell
- noctx
- predeclared
- stylecheck
- whitespace
- wsl
Expand All @@ -76,13 +76,13 @@ linters:
run:
build-tags:
- gingonic
skip-dirs:
- scripts
- docker
- samples
#modules-download-mode: vendor

issues:
exclude-dirs:
- scripts
- docker
- samples
exclude-rules:
- linters:
- gosec
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @metal-toolbox/provisioning-core @metal-toolbox/hardware-core
2 changes: 1 addition & 1 deletion config/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"strings"

"github.com/bmc-toolbox/common"
common "github.com/metal-toolbox/bmc-common"
)

type VendorConfigManager interface {
Expand Down
2 changes: 1 addition & 1 deletion constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func FormatProductName(s string) string {
return "x12spo-ntf"
case "Micron_5200_MTFDDAK480TDN":
return "5200MAX"
case "SYS-221H-TN24R":
case "SYS-221H-TN24R", "SYS-221H-TNR":
return "x13dem"
default:
return s
Expand Down
54 changes: 51 additions & 3 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
// server hardware and its component attributes between libraries/tools.
package common

type Component interface {
GetDescription() string
GetVendor() string
GetModel() string
GetSerial() string
GetProductName() string
GetLogicalName() string
GetCapabilities() []*Capability
GetMetadata() map[string]string
GetFirmware() *Firmware
IsNil() bool
}

// Common holds attributes shared by all components
type Common struct {
Oem bool `json:"oem"`
Expand All @@ -19,6 +32,42 @@ type Common struct {
Status *Status `json:"status,omitempty"`
}

func (c *Common) GetDescription() string {
return c.Description
}

func (c *Common) GetVendor() string {
return c.Vendor
}

func (c *Common) GetModel() string {
return c.Model
}

func (c *Common) GetSerial() string {
return c.Serial
}

func (c *Common) GetProductName() string {
return c.ProductName
}

func (c *Common) GetLogicalName() string {
return c.LogicalName
}

func (c *Common) GetCapabilities() []*Capability {
return c.Capabilities
}

func (c *Common) GetMetadata() map[string]string {
return c.Metadata
}

func (c *Common) GetFirmware() *Firmware {
return c.Firmware
}

// Device type is composed of various components
type Device struct {
Common
Expand Down Expand Up @@ -97,9 +146,8 @@ type GPU struct {
type Enclosure struct {
Common

ID string `json:"id,omitempty"`
ChassisType string `json:"chassis_type,omitempty"`
Firmware *Firmware `json:"firmware,omitempty"`
ID string `json:"id,omitempty"`
ChassisType string `json:"chassis_type,omitempty"`
}

// TPM component
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/bmc-toolbox/common
module github.com/metal-toolbox/bmc-common

go 1.17

Expand Down
42 changes: 42 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Loading