Skip to content

Commit

Permalink
Fixes multiple files behavior in files rootfs
Browse files Browse the repository at this point in the history
Some files may be left uncopied to the VM when there are multiple
files in the .minikube/files directory as the code misinterprets
the last parent dir as parent dirs for all files, which results
some files with the same name were not copied.

This patch fixes the behavior.
  • Loading branch information
laozc committed Jan 2, 2019
1 parent 6a04066 commit a7a105d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,14 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro
return errors.Wrapf(err, "checking if %s is directory", hostpath)
}
if !isDir {
if vmpath == "" {
vmdir := vmpath
if vmdir == "" {
rPath, err := filepath.Rel(basedir, hostpath)
if err != nil {
return errors.Wrap(err, "generating relative path")
}
rPath = filepath.Dir(rPath)
vmpath = filepath.Join("/", rPath)
vmdir = filepath.Join("/", rPath)
}
permString := fmt.Sprintf("%o", info.Mode().Perm())
// The conversion will strip the leading 0 if present, so add it back
Expand All @@ -282,7 +283,7 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro
permString = fmt.Sprintf("0%s", permString)
}

f, err := NewFileAsset(hostpath, vmpath, filepath.Base(hostpath), permString)
f, err := NewFileAsset(hostpath, vmdir, filepath.Base(hostpath), permString)
if err != nil {
return errors.Wrapf(err, "creating file asset for %s", hostpath)
}
Expand Down

0 comments on commit a7a105d

Please sign in to comment.