Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minikube cp create non-existing directory instead of failing #17715

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/minikube/command/ssh_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func (s *SSHRunner) Copy(f assets.CopyableFile) error {
return nil
})

scp := fmt.Sprintf("sudo test -d %s && sudo scp -t %s", f.GetTargetDir(), f.GetTargetDir())
scp := fmt.Sprintf("sudo mkdir -p %s && sudo scp -t %s", f.GetTargetDir(), f.GetTargetDir())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any code about "cp" that needs to be changed as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary, however, I was thinking about dropping test -d and we could call scp with the -r flag instead:

> man scp
...
-r      Recursively copy entire directories.  Note that scp follows symbolic links encountered in the tree traversal.`

Note, that if anybody expects it to fail, when the path does not exist, this will stop failing.

mtime, err := f.GetModTime()
if err != nil {
klog.Infof("error getting modtime for %s: %v", dst, err)
Expand Down
3 changes: 3 additions & 0 deletions test/integration/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,9 @@ func validateCpCmd(ctx context.Context, t *testing.T, profile string) {

tmpPath := filepath.Join(tmpDir, "cp-test.txt")
testCpCmd(ctx, t, profile, profile, dstPath, "", tmpPath)

// copy to nonexistent directory structure
testCpCmd(ctx, t, profile, "", srcPath, "", "/tmp/does/not/exist/cp-test.txt")
}

// validateMySQL validates a minimalist MySQL deployment
Expand Down
Loading