Skip to content

Commit 2389965

Browse files
committed
Merge branch 'master' of https://github.com/metal-stack/metal-api into dualstack-support
2 parents aae9274 + 89978cc commit 2389965

File tree

7 files changed

+13
-41
lines changed

7 files changed

+13
-41
lines changed

cmd/metal-api/internal/datastore/image.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/Masterminds/semver/v3"
1010
"github.com/metal-stack/metal-api/cmd/metal-api/internal/metal"
11-
"github.com/metal-stack/metal-api/cmd/metal-api/internal/utils"
11+
metalcommon "github.com/metal-stack/metal-lib/pkg/metal"
1212
r "gopkg.in/rethinkdb/rethinkdb-go.v6"
1313
)
1414

@@ -201,7 +201,7 @@ func isOrphanImage(image metal.Image, machines metal.Machines) bool {
201201
// then the most recent ubuntu image (ubuntu-19.10.20200407) is returned
202202
// If patch is specified e.g. ubuntu-20.04.20200502 then this exact image is searched.
203203
func (rs *RethinkStore) getMostRecentImageFor(id string, images metal.Images) (*metal.Image, error) {
204-
os, sv, err := utils.GetOsAndSemverFromImage(id)
204+
os, sv, err := metalcommon.GetOsAndSemverFromImage(id)
205205
if err != nil {
206206
return nil, err
207207
}
@@ -248,7 +248,7 @@ func (rs *RethinkStore) getMostRecentImageFor(id string, images metal.Images) (*
248248
// then all ubuntu images (ubuntu-19.10.*) are returned
249249
// If patch is specified e.g. ubuntu-20.04.20200502 then this exact image is searched.
250250
func getImagesFor(id string, images metal.Images) ([]metal.Image, error) {
251-
os, sv, err := utils.GetOsAndSemverFromImage(id)
251+
os, sv, err := metalcommon.GetOsAndSemverFromImage(id)
252252
if err != nil {
253253
return nil, err
254254
}

cmd/metal-api/internal/datastore/image_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/google/go-cmp/cmp"
1010
"github.com/metal-stack/metal-api/cmd/metal-api/internal/metal"
1111
"github.com/metal-stack/metal-api/cmd/metal-api/internal/testdata"
12-
"github.com/metal-stack/metal-api/cmd/metal-api/internal/utils"
12+
metalcommon "github.com/metal-stack/metal-lib/pkg/metal"
1313
"github.com/stretchr/testify/assert"
1414
"github.com/stretchr/testify/require"
1515
)
@@ -403,7 +403,7 @@ func TestGetOsAndSemver(t *testing.T) {
403403
for i := range tests {
404404
tt := tests[i]
405405
t.Run(tt.name, func(t *testing.T) {
406-
os, version, err := utils.GetOsAndSemverFromImage(tt.id)
406+
os, version, err := metalcommon.GetOsAndSemverFromImage(tt.id)
407407
if (err != nil) != tt.wantErr {
408408
t.Errorf("GetOsAndSemver() error = %v, wantErr %v", err, tt.wantErr)
409409
return

cmd/metal-api/internal/metal/filesystem.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import (
88
"strings"
99

1010
"github.com/Masterminds/semver/v3"
11-
"github.com/metal-stack/metal-api/cmd/metal-api/internal/utils"
11+
12+
metalcommon "github.com/metal-stack/metal-lib/pkg/metal"
1213
)
1314

1415
const (
@@ -470,7 +471,7 @@ func (c *FilesystemLayoutConstraints) matches(sizeID, imageID string) bool {
470471
}
471472
// Size matches
472473
for os, versionconstraint := range c.Images {
473-
imageos, version, err := utils.GetOsAndSemverFromImage(imageID)
474+
imageos, version, err := metalcommon.GetOsAndSemverFromImage(imageID)
474475
if err != nil {
475476
return false
476477
}

cmd/metal-api/internal/service/image-service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"github.com/metal-stack/metal-api/cmd/metal-api/internal/datastore"
1212
"github.com/metal-stack/metal-api/cmd/metal-api/internal/metal"
1313
v1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1"
14-
"github.com/metal-stack/metal-api/cmd/metal-api/internal/utils"
1514
"github.com/metal-stack/metal-lib/auditing"
15+
metalcommon "github.com/metal-stack/metal-lib/pkg/metal"
1616

1717
restfulspec "github.com/emicklei/go-restful-openapi/v2"
1818
restful "github.com/emicklei/go-restful/v3"
@@ -297,7 +297,7 @@ func (r *imageResource) createImage(request *restful.Request, response *restful.
297297
features[ft] = true
298298
}
299299

300-
os, v, err := utils.GetOsAndSemverFromImage(requestPayload.ID)
300+
os, v, err := metalcommon.GetOsAndSemverFromImage(requestPayload.ID)
301301
if err != nil {
302302
r.sendError(request, response, httperrors.BadRequest(err))
303303
return

cmd/metal-api/internal/utils/utils.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/looplab/fsm v1.0.2
2121
github.com/metal-stack/go-ipam v1.14.1
2222
github.com/metal-stack/masterdata-api v0.11.4
23-
github.com/metal-stack/metal-lib v0.17.1
23+
github.com/metal-stack/metal-lib v0.17.2
2424
github.com/metal-stack/security v0.8.0
2525
github.com/metal-stack/v v1.0.3
2626
github.com/nsqio/go-nsq v1.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ github.com/metal-stack/go-ipam v1.14.1 h1:kTe4GUvLTNd27sad2uzxZUS5jD7pZfgfr077xo
299299
github.com/metal-stack/go-ipam v1.14.1/go.mod h1:0KqCwF1nTB3SZGED+Z+bxdZwXQjP7CiLPcjGDLMKn3s=
300300
github.com/metal-stack/masterdata-api v0.11.4 h1:bgRk7PbD5BjYbmAReaV7gTKKKrW5x/ZzCwj98VSWoJk=
301301
github.com/metal-stack/masterdata-api v0.11.4/go.mod h1:fD0AtsoNNaOLqRMBeZzDFljiQW9RlrOnxeZ20Pqhxas=
302-
github.com/metal-stack/metal-lib v0.17.1 h1:JLa4wJ62dgxtY9UOLF+QDk10/i/W5vhzrv8RsundDUY=
303-
github.com/metal-stack/metal-lib v0.17.1/go.mod h1:nyNGI4DZFOcWbSoq2Y6V3SHpFxuXBIqYBZHTb6cy//s=
302+
github.com/metal-stack/metal-lib v0.17.2 h1:T1rxCPgagHW/M0wWSrOj4hWsPZMSt1pYw90Z3vBm88Q=
303+
github.com/metal-stack/metal-lib v0.17.2/go.mod h1:nyNGI4DZFOcWbSoq2Y6V3SHpFxuXBIqYBZHTb6cy//s=
304304
github.com/metal-stack/security v0.8.0 h1:tVaSDB9m5clwYrnLyaXfPy7mQlJTnmeoHscG+RUy/xo=
305305
github.com/metal-stack/security v0.8.0/go.mod h1:7GAcQb+pOgflW30ohJygxpqc3i0dQ2ahGJK1CU5tqa0=
306306
github.com/metal-stack/v v1.0.3 h1:Sh2oBlnxrCUD+mVpzfC8HiqL045YWkxs0gpTvkjppqs=

0 commit comments

Comments
 (0)