fix cp time stamp is in the future error

This commit is contained in:
tanshanshan 2019-02-13 08:52:08 +08:00
parent 727dd667d6
commit e959d477bb
2 changed files with 4 additions and 4 deletions

View File

@ -244,9 +244,9 @@ func (o *CopyOptions) copyToPod(src, dest fileSpec, options *exec.ExecOptions) e
// TODO: Improve error messages by first testing if 'tar' is present in the container? // TODO: Improve error messages by first testing if 'tar' is present in the container?
if o.NoPreserve { if o.NoPreserve {
cmdArr = []string{"tar", "--no-same-permissions", "--no-same-owner", "-xf", "-"} cmdArr = []string{"tar", "--no-same-permissions", "--no-same-owner", "-xmf", "-"}
} else { } else {
cmdArr = []string{"tar", "-xf", "-"} cmdArr = []string{"tar", "-xmf", "-"}
} }
destDir := path.Dir(dest.File) destDir := path.Dir(dest.File)
if len(destDir) > 0 { if len(destDir) > 0 {

View File

@ -641,11 +641,11 @@ func TestCopyToPodNoPreserve(t *testing.T) {
nopreserve bool nopreserve bool
}{ }{
"copy to pod no preserve user and permissions": { "copy to pod no preserve user and permissions": {
expectedCmd: []string{"tar", "--no-same-permissions", "--no-same-owner", "-xf", "-", "-C", "."}, expectedCmd: []string{"tar", "--no-same-permissions", "--no-same-owner", "-xmf", "-", "-C", "."},
nopreserve: true, nopreserve: true,
}, },
"copy to pod preserve user and permissions": { "copy to pod preserve user and permissions": {
expectedCmd: []string{"tar", "-xf", "-", "-C", "."}, expectedCmd: []string{"tar", "-xmf", "-", "-C", "."},
nopreserve: false, nopreserve: false,
}, },
} }