Skip to content

Commit f2fe8ac

Browse files
author
Timothy MacDonald
authored
fix: component won't install (#1459)
When the tmp dir and install dir are on different devices component won't install Signed-off-by: Timothy MacDonald <[email protected]>
1 parent 93b4576 commit f2fe8ac

34 files changed

+1359
-4
lines changed

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ require (
6262
github.com/hashicorp/consul/sdk v0.13.1
6363
github.com/mattn/go-isatty v0.0.18
6464
github.com/mitchellh/hashstructure/v2 v2.0.2
65+
github.com/otiai10/copy v1.14.0
6566
github.com/pmezard/go-difflib v1.0.0
6667
github.com/spf13/cast v1.5.0
6768
golang.org/x/exp v0.0.0-20221208152030-732eee02a75a
@@ -134,6 +135,7 @@ require (
134135
go.uber.org/multierr v1.6.0 // indirect
135136
golang.org/x/mod v0.8.0 // indirect
136137
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
138+
golang.org/x/sync v0.3.0 // indirect
137139
golang.org/x/sys v0.13.0 // indirect
138140
golang.org/x/term v0.13.0 // indirect
139141
golang.org/x/tools v0.6.0 // indirect

go.sum

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx
376376
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
377377
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
378378
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
379+
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
380+
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
381+
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
382+
github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
379383
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
380384
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
381385
github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=
@@ -589,8 +593,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
589593
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
590594
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
591595
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
592-
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
593-
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
596+
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
597+
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
594598
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
595599
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
596600
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

lwcomponent/component.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"aead.dev/minisign"
3636
"github.com/Masterminds/semver"
3737
"github.com/cenkalti/backoff/v4"
38+
dircopy "github.com/otiai10/copy"
3839
"github.com/pkg/errors"
3940

4041
"github.com/lacework/go-sdk/api"
@@ -306,12 +307,12 @@ func (s State) Install(component *Component, version string) error {
306307
return err
307308
}
308309
//move the component from the staging dir to it's path
309-
if err = os.Rename(stagingPath, path); err != nil {
310+
if err = file.Copy(stagingPath, path); err != nil {
310311
return err
311312
}
312313
} else {
313314
//move the component from the staging dir to it's root path
314-
if err = os.Rename(stagingPath, rPath); err != nil {
315+
if err = dircopy.Copy(stagingPath, rPath); err != nil {
315316
return err
316317
}
317318
}

vendor/github.com/otiai10/copy/.gitignore

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/otiai10/copy/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/otiai10/copy/README.md

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)