Skip to content

Commit 2e18efa

Browse files
committed
Bump twpayne/vfs module to latest version
Specifically bumping from v1.7.2 to v4.3.0. We were pretty outdated. This commit could not get rid of the old version dependency completely because yip requires a vfs v1 within the plugin API and we implement a yip plugin for partitioning in elemental-toolkit. Because of that both versions are coexisting. Signed-off-by: David Cassany <[email protected]>
1 parent ec43513 commit 2e18efa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1500
-225
lines changed

cmd/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
"github.com/sirupsen/logrus"
3434
"github.com/spf13/pflag"
3535
"github.com/spf13/viper"
36-
"github.com/twpayne/go-vfs"
37-
"github.com/twpayne/go-vfs/vfst"
36+
"github.com/twpayne/go-vfs/v4"
37+
"github.com/twpayne/go-vfs/v4/vfst"
3838

3939
"github.com/rancher/elemental-toolkit/pkg/constants"
4040
v1mock "github.com/rancher/elemental-toolkit/pkg/mocks"

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ require (
110110
github.com/spf13/jwalterweatherman v1.1.0 // indirect
111111
github.com/subosito/gotenv v1.4.2 // indirect
112112
github.com/tredoe/osutil/v2 v2.0.0-rc.16 // indirect
113+
github.com/twpayne/go-vfs/v4 v4.3.0
113114
github.com/ulikunitz/xz v0.5.11 // indirect
114115
github.com/vbatts/tar-split v0.11.3 // indirect
115116
github.com/vishvananda/netlink v1.2.1-beta.2 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX
6060
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
6161
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
6262
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
63+
github.com/alecthomas/assert/v2 v2.3.0 h1:mAsH2wmvjsuvyBvAmCtm7zFsBlb8mIHx5ySLVdDZXL0=
64+
github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ=
65+
github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk=
66+
github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
6367
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
6468
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
6569
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
@@ -279,6 +283,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
279283
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
280284
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
281285
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
286+
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
287+
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
282288
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
283289
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
284290
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
@@ -494,6 +500,8 @@ github.com/tredoe/osutil/v2 v2.0.0-rc.16 h1:5A2SKvyB2c3lhPYUIHyFtu6jbaXlaA3Hu5gW
494500
github.com/tredoe/osutil/v2 v2.0.0-rc.16/go.mod h1:uLRVx/3pb7Y4RQhG8cQFbPE9ha5r81e6MXpBsxbTAYc=
495501
github.com/twpayne/go-vfs v1.7.2 h1:ZNYMAXcu2Av8c109USrSGYm8dIIIV0xPlG19I2088Kw=
496502
github.com/twpayne/go-vfs v1.7.2/go.mod h1:1eni2ntkiiAHZG27xfLOO4CYvMR4Kw8V7rYiLeeolsQ=
503+
github.com/twpayne/go-vfs/v4 v4.3.0 h1:rTqFzzOQ/6ESKTSiwVubHlCBedJDOhQyVSnw8rQNZhU=
504+
github.com/twpayne/go-vfs/v4 v4.3.0/go.mod h1:tq2UVhnUepesc0lSnPJH/jQ8HruGhzwZe2r5kDFpEIw=
497505
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
498506
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
499507
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=

pkg/action/build-disk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ func Raw2Gce(source string, fs v1.FS, logger v1.Logger, keepOldImage bool) error
488488
// The disk image filename must be disk.raw.
489489
// The compressed file must be a .tar.gz file that uses gzip compression and the --format=oldgnu option for the tar utility.
490490
logger.Info("Transforming raw image into gce format")
491-
actImg, err := fs.Open(source)
491+
actImg, err := fs.OpenFile(source, os.O_CREATE|os.O_APPEND|os.O_WRONLY, constants.FilePerm)
492492
if err != nil {
493493
return elementalError.NewFromError(err, elementalError.OpenFile)
494494
}

pkg/action/build_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ import (
2121
"encoding/binary"
2222
"encoding/hex"
2323
"errors"
24+
"os"
2425
"path/filepath"
2526
"strconv"
2627

2728
. "github.com/onsi/ginkgo/v2"
2829
. "github.com/onsi/gomega"
2930
"github.com/sirupsen/logrus"
30-
"github.com/twpayne/go-vfs"
31-
"github.com/twpayne/go-vfs/vfst"
31+
"github.com/twpayne/go-vfs/v4"
32+
"github.com/twpayne/go-vfs/v4/vfst"
3233

3334
"github.com/rancher/elemental-toolkit/pkg/action"
3435
"github.com/rancher/elemental-toolkit/pkg/config"
@@ -375,7 +376,7 @@ var _ = Describe("Build Actions", func() {
375376
Expect(info.Size()).To(BeNumerically("==", 23*1024*1024))
376377

377378
// Read the header
378-
f, _ = fs.Open(filepath.Join(tmpDir, "disk.raw.vhd"))
379+
f, _ = fs.OpenFile(filepath.Join(tmpDir, "disk.raw.vhd"), os.O_RDONLY, constants.FilePerm)
379380
info, _ = f.Stat()
380381
// Dump the header from the file into our VHDHeader
381382
buff := make([]byte, 512)
@@ -415,7 +416,7 @@ var _ = Describe("Build Actions", func() {
415416
Expect(info.Size()).To(BeNumerically("==", 1*1024*1024))
416417

417418
// Read the header
418-
f, _ = fs.Open(filepath.Join(tmpDir, "disk.raw.vhd"))
419+
f, _ = fs.OpenFile(filepath.Join(tmpDir, "disk.raw.vhd"), os.O_RDONLY, constants.FilePerm)
419420
info, _ = f.Stat()
420421
// Dump the header from the file into our VHDHeader
421422
buff := make([]byte, 512)

pkg/action/init_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
. "github.com/onsi/ginkgo/v2"
2424
. "github.com/onsi/gomega"
2525
"github.com/sirupsen/logrus"
26-
"github.com/twpayne/go-vfs"
27-
"github.com/twpayne/go-vfs/vfst"
26+
"github.com/twpayne/go-vfs/v4"
27+
"github.com/twpayne/go-vfs/v4/vfst"
2828

2929
"github.com/rancher/elemental-toolkit/pkg/action"
3030
"github.com/rancher/elemental-toolkit/pkg/config"

pkg/action/install_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import (
2626

2727
. "github.com/onsi/ginkgo/v2"
2828
. "github.com/onsi/gomega"
29-
"github.com/twpayne/go-vfs"
30-
"github.com/twpayne/go-vfs/vfst"
29+
"github.com/twpayne/go-vfs/v4"
30+
"github.com/twpayne/go-vfs/v4/vfst"
3131

3232
"github.com/rancher/elemental-toolkit/pkg/action"
3333
conf "github.com/rancher/elemental-toolkit/pkg/config"

pkg/action/mount_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
. "github.com/onsi/ginkgo/v2"
2424
. "github.com/onsi/gomega"
2525
"github.com/sirupsen/logrus"
26-
"github.com/twpayne/go-vfs"
27-
"github.com/twpayne/go-vfs/vfst"
26+
"github.com/twpayne/go-vfs/v4"
27+
"github.com/twpayne/go-vfs/v4/vfst"
2828
"k8s.io/mount-utils"
2929

3030
"github.com/rancher/elemental-toolkit/pkg/action"

pkg/action/reset_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"github.com/jaypipes/ghw/pkg/block"
2525
. "github.com/onsi/ginkgo/v2"
2626
. "github.com/onsi/gomega"
27-
"github.com/twpayne/go-vfs"
28-
"github.com/twpayne/go-vfs/vfst"
27+
"github.com/twpayne/go-vfs/v4"
28+
"github.com/twpayne/go-vfs/v4/vfst"
2929

3030
"github.com/rancher/elemental-toolkit/pkg/action"
3131
conf "github.com/rancher/elemental-toolkit/pkg/config"

pkg/action/upgrade_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
. "github.com/onsi/ginkgo/v2"
2828
. "github.com/onsi/gomega"
2929
"github.com/sirupsen/logrus"
30-
"github.com/twpayne/go-vfs"
31-
"github.com/twpayne/go-vfs/vfst"
30+
"github.com/twpayne/go-vfs/v4"
31+
"github.com/twpayne/go-vfs/v4/vfst"
3232

3333
"github.com/rancher/elemental-toolkit/pkg/action"
3434
conf "github.com/rancher/elemental-toolkit/pkg/config"

0 commit comments

Comments
 (0)