From 5fcaa5d5e2dbb289db2bbcb6dce6df8eb2348c67 Mon Sep 17 00:00:00 2001 From: Markus Fensterer Date: Thu, 21 Sep 2023 10:53:37 +0200 Subject: [PATCH 1/9] support novarion servers as well --- connect/connect.go | 4 ++++ pkg/api/types.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/connect/connect.go b/connect/connect.go index a5b6625..da68a1d 100644 --- a/connect/connect.go +++ b/connect/connect.go @@ -29,6 +29,8 @@ func InBand(log logger.Logger) (hal.InBand, error) { switch b.Vendor { case api.VendorLenovo: return lenovo.InBand(b, log) + case api.VendorNovarion: + fallthrough case api.VendorSupermicro: return supermicro.InBand(b, log) case api.VendorVagrant: @@ -56,6 +58,8 @@ func OutBand(ip string, ipmiPort int, user, password string, log logger.Logger) switch b.Vendor { case api.VendorLenovo: return lenovo.OutBand(r, b), nil + case api.VendorNovarion: + fallthrough case api.VendorSupermicro: return supermicro.OutBand(r, b, ip, ipmiPort, user, password, log) case api.VendorVagrant: diff --git a/pkg/api/types.go b/pkg/api/types.go index c06a0ff..0739471 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -178,6 +178,8 @@ const ( VendorUnknown Vendor = iota // VendorSupermicro identifies all Supermicro servers VendorSupermicro + // VendorNovarion identifies all Novarion servers + VendorNovarion // VendorLenovo identifies all Lenovo servers VendorLenovo // VendorDell identifies all Dell servers From 816c07cb438168eb776943cbdfa379aa116b89f7 Mon Sep 17 00:00:00 2001 From: Markus Fensterer Date: Thu, 21 Sep 2023 11:02:33 +0200 Subject: [PATCH 2/9] use golang 1.20 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8c55e70..f4e51e9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/metal-stack/go-hal -go 1.18 +go 1.20 require ( github.com/avast/retry-go/v4 v4.3.2 From 2d7eaf4ec3e14190f74101cf1c9834923c3b4a35 Mon Sep 17 00:00:00 2001 From: Markus Fensterer Date: Thu, 21 Sep 2023 11:15:59 +0200 Subject: [PATCH 3/9] include novarion in list of vendors --- pkg/api/types.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/api/types.go b/pkg/api/types.go index 0739471..1e34122 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -191,12 +191,13 @@ const ( var ( vendors = [...]string{ VendorSupermicro: "Supermicro", + VendorNovarion: "Novarion-Systems", VendorLenovo: "Lenovo", VendorDell: "Dell", VendorVagrant: "Vagrant", VendorUnknown: "UNKNOWN", } - allVendors = [...]Vendor{VendorSupermicro, VendorLenovo, VendorDell, VendorVagrant, VendorUnknown} + allVendors = [...]Vendor{VendorSupermicro, VendorNovarion, VendorLenovo, VendorDell, VendorVagrant, VendorUnknown} ) func (v Vendor) String() string { return vendors[v] } From 43bd82ff239239a70c997fb2cc45e9a68c80f7cf Mon Sep 17 00:00:00 2001 From: Markus Fensterer Date: Thu, 21 Sep 2023 11:27:22 +0200 Subject: [PATCH 4/9] make linter happy --- connect/connect.go | 8 ++------ internal/console/console.go | 6 +++--- internal/ipmi/ipmitool.go | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/connect/connect.go b/connect/connect.go index da68a1d..07185bc 100644 --- a/connect/connect.go +++ b/connect/connect.go @@ -29,9 +29,7 @@ func InBand(log logger.Logger) (hal.InBand, error) { switch b.Vendor { case api.VendorLenovo: return lenovo.InBand(b, log) - case api.VendorNovarion: - fallthrough - case api.VendorSupermicro: + case api.VendorSupermicro, api.VendorNovarion: return supermicro.InBand(b, log) case api.VendorVagrant: return vagrant.InBand(b, log) @@ -58,9 +56,7 @@ func OutBand(ip string, ipmiPort int, user, password string, log logger.Logger) switch b.Vendor { case api.VendorLenovo: return lenovo.OutBand(r, b), nil - case api.VendorNovarion: - fallthrough - case api.VendorSupermicro: + case api.VendorSupermicro, api.VendorNovarion: return supermicro.OutBand(r, b, ip, ipmiPort, user, password, log) case api.VendorVagrant: return vagrant.OutBand(b, ip, ipmiPort, user, password), nil diff --git a/internal/console/console.go b/internal/console/console.go index 6ca2b2d..fc00b46 100644 --- a/internal/console/console.go +++ b/internal/console/console.go @@ -71,11 +71,11 @@ func Open(s ssh.Session, cmd *exec.Cmd) error { <-done if winSizeErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), winSizeErr) + err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), winSizeErr) } else if stdinErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdinErr) + err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdinErr) } else if stdoutErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdoutErr) + err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdoutErr) } else { err2 := s.Exit(0) if err2 != nil { diff --git a/internal/ipmi/ipmitool.go b/internal/ipmi/ipmitool.go index fcd98d1..0234d84 100644 --- a/internal/ipmi/ipmitool.go +++ b/internal/ipmi/ipmitool.go @@ -593,7 +593,7 @@ func GetBootOrderQualifiers(bootTarget hal.BootTarget, vendor api.Vendor) (uefiQ case hal.BootTargetDisk: uefiQualifier = persistentUEFIQualifier switch vendor { - case api.VendorSupermicro: + case api.VendorSupermicro, api.VendorNovarion: bootDevQualifier = supermicroHDQualifier case api.VendorLenovo, api.VendorDell, api.VendorVagrant, api.VendorUnknown: fallthrough From 904dfe94f406c0b9b9d74061df3507b033d251e6 Mon Sep 17 00:00:00 2001 From: Markus Fensterer Date: Thu, 21 Sep 2023 11:30:20 +0200 Subject: [PATCH 5/9] make linter happy --- internal/console/console.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/console/console.go b/internal/console/console.go index fc00b46..6e21b26 100644 --- a/internal/console/console.go +++ b/internal/console/console.go @@ -71,11 +71,11 @@ func Open(s ssh.Session, cmd *exec.Cmd) error { <-done if winSizeErr != nil { - err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), winSizeErr) + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), winSizeErr) //nolint:wrapcheck } else if stdinErr != nil { - err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdinErr) + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdinErr) //nolint:wrapcheck } else if stdoutErr != nil { - err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdoutErr) + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdoutErr) //nolint:wrapcheck } else { err2 := s.Exit(0) if err2 != nil { From 6bcd5f4b15af303ce8c06eaa6e217721463916b8 Mon Sep 17 00:00:00 2001 From: Markus Fensterer Date: Thu, 21 Sep 2023 11:33:36 +0200 Subject: [PATCH 6/9] make linter happy --- internal/console/console.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/console/console.go b/internal/console/console.go index 6e21b26..281a8a0 100644 --- a/internal/console/console.go +++ b/internal/console/console.go @@ -71,11 +71,11 @@ func Open(s ssh.Session, cmd *exec.Cmd) error { <-done if winSizeErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), winSizeErr) //nolint:wrapcheck + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), winSizeErr) //nolint:errorlint } else if stdinErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdinErr) //nolint:wrapcheck + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdinErr) //nolint:errorlint } else if stdoutErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdoutErr) //nolint:wrapcheck + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdoutErr) //nolint:errorlint } else { err2 := s.Exit(0) if err2 != nil { From fdf588f31887aad8711d3eaf723c6a628e74e8b1 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 11 Oct 2023 08:52:58 +0200 Subject: [PATCH 7/9] Fix error shown by linter --- internal/console/console.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/console/console.go b/internal/console/console.go index 281a8a0..9f76c91 100644 --- a/internal/console/console.go +++ b/internal/console/console.go @@ -71,11 +71,12 @@ func Open(s ssh.Session, cmd *exec.Cmd) error { <-done if winSizeErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), winSizeErr) //nolint:errorlint + // FIXME why calling s.Exit(1) in the error message ? + err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), winSizeErr) } else if stdinErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdinErr) //nolint:errorlint + err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdinErr) } else if stdoutErr != nil { - err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdoutErr) //nolint:errorlint + err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdoutErr) } else { err2 := s.Exit(0) if err2 != nil { From 015dc1d8d90f7b87cac529c284c6bfb942b0f60f Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 11 Oct 2023 08:57:38 +0200 Subject: [PATCH 8/9] Fix error shown by linter --- internal/console/console.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/console/console.go b/internal/console/console.go index 9f76c91..435da2b 100644 --- a/internal/console/console.go +++ b/internal/console/console.go @@ -72,11 +72,11 @@ func Open(s ssh.Session, cmd *exec.Cmd) error { if winSizeErr != nil { // FIXME why calling s.Exit(1) in the error message ? - err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), winSizeErr) + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), winSizeErr) // nolint:errorlint } else if stdinErr != nil { - err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdinErr) + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdinErr) // nolint:errorlint } else if stdoutErr != nil { - err = fmt.Errorf("exit ssh session:%w error:%w", s.Exit(1), stdoutErr) + err = fmt.Errorf("exit ssh session:%s error:%w", s.Exit(1), stdoutErr) // nolint:errorlint } else { err2 := s.Exit(0) if err2 != nil { From 940de14eb87e197ad2c7358b8579b42e629b952b Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 11 Oct 2023 08:59:12 +0200 Subject: [PATCH 9/9] Update ci --- .github/workflows/master.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index a1acb35..3c9b03e 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -13,17 +13,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: args: -p bugs -p unused - - name: Set up Go 1.18 - uses: actions/setup-go@v2 + - name: Set up Go 1.21 + uses: actions/setup-go@v4 with: - go-version: '1.18.x' + go-version: '1.21.x' - name: Test run: |