Fixed the bug with importing container/vnfs from a directory.
This commit is contained in:
1
go.mod
1
go.mod
@@ -5,6 +5,7 @@ go 1.15
|
||||
require (
|
||||
github.com/brotherpowers/ipsubnet v0.0.0-20170914094241-30bc98f0a5b1
|
||||
github.com/containers/image/v5 v5.7.0
|
||||
github.com/docker/docker v1.4.2-0.20191219165747-a9416c67da9f
|
||||
github.com/manifoldco/promptui v0.8.0
|
||||
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6
|
||||
github.com/opencontainers/umoci v0.4.6
|
||||
|
||||
2
go.sum
2
go.sum
@@ -19,6 +19,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 h1:ygIc8M6trr62pF5DucadTWGdEB4mEyvzi0e2nbcmcyA=
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
|
||||
github.com/Microsoft/hcsshim v0.8.9 h1:VrfodqvztU8YSOvygU+DN1BGaSGxmrNfqOv5oOuX2Bk=
|
||||
github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
|
||||
@@ -61,6 +62,7 @@ github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on
|
||||
github.com/containerd/console v1.0.0/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE=
|
||||
github.com/containerd/containerd v1.3.2 h1:ForxmXkA6tPIvffbrDAcPUIB32QgXkt2XFj+F0UxetA=
|
||||
github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc h1:TP+534wVlf61smEIq1nwLLAjQVEK2EADoW3CX9AuT+8=
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
|
||||
github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0=
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/hpcng/warewulf/internal/pkg/config"
|
||||
"github.com/hpcng/warewulf/internal/pkg/errors"
|
||||
"github.com/hpcng/warewulf/internal/pkg/oci"
|
||||
"github.com/docker/docker/daemon/graphdriver/copy"
|
||||
)
|
||||
|
||||
func ImportDocker(uri string, name string, sCtx *types.SystemContext) error {
|
||||
@@ -62,11 +63,11 @@ func ImportDirectory(uri string, name string) error {
|
||||
return errors.New("Import directory does not exist: " + uri)
|
||||
}
|
||||
|
||||
if !util.IsFile(path.Join(fullPath, "/bin/sh")) {
|
||||
if !util.IsFile(path.Join(uri, "/bin/sh")) {
|
||||
return errors.New("Source directory has no /bin/sh: " + uri)
|
||||
}
|
||||
|
||||
err = util.CopyFiles(uri, fullPath)
|
||||
err = copy.DirCopy(uri, fullPath, copy.Content, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ func CopyFiles(source string, dest string) error {
|
||||
//TODO: func CopyRecursive ...
|
||||
|
||||
func IsDir(path string) bool {
|
||||
wwlog.Printf(wwlog.DEBUG, "Chcking if path exists as a directory: %s\n", path)
|
||||
wwlog.Printf(wwlog.DEBUG, "Checking if path exists as a directory: %s\n", path)
|
||||
|
||||
if path == "" {
|
||||
return false
|
||||
@@ -138,7 +138,7 @@ func IsDir(path string) bool {
|
||||
}
|
||||
|
||||
func IsFile(path string) bool {
|
||||
wwlog.Printf(wwlog.DEBUG, "Chcking if path exists as a file: %s\n", path)
|
||||
wwlog.Printf(wwlog.DEBUG, "Checking if path exists as a file: %s\n", path)
|
||||
|
||||
if path == "" {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user