mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Introduce podman machine cp
command
Add a new `podman machine cp` subcommand to allow users to copy files or directories between a running Podman Machine and their host. Tests cover the following cases: - Copy a file from the host machine to the VM - Copy a directory from the host machine to the VM - Copy a file from the VM to the host machine - Copy a directory from the VM to the host machine - Copy a file to a directory - Copy a directory to a file Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
This commit is contained in:
@ -114,12 +114,7 @@ func commonNativeSSH(username, identityPath, name string, sshPort int, inputArgs
|
||||
port := strconv.Itoa(sshPort)
|
||||
interactive := true
|
||||
|
||||
args := []string{"-i", identityPath, "-p", port, sshDestination,
|
||||
"-o", "IdentitiesOnly=yes",
|
||||
"-o", "StrictHostKeyChecking=no",
|
||||
"-o", "UserKnownHostsFile=" + os.DevNull,
|
||||
"-o", "CheckHostIP=no",
|
||||
"-o", "LogLevel=ERROR", "-o", "SetEnv=LC_ALL="}
|
||||
args := append([]string{"-i", identityPath, "-p", port, sshDestination}, CommonSSHArgs()...)
|
||||
if len(inputArgs) > 0 {
|
||||
interactive = false
|
||||
args = append(args, inputArgs...)
|
||||
@ -138,3 +133,13 @@ func commonNativeSSH(username, identityPath, name string, sshPort int, inputArgs
|
||||
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func CommonSSHArgs() []string {
|
||||
return []string{
|
||||
"-o", "IdentitiesOnly=yes",
|
||||
"-o", "StrictHostKeyChecking=no",
|
||||
"-o", "UserKnownHostsFile=" + os.DevNull,
|
||||
"-o", "CheckHostIP=no",
|
||||
"-o", "LogLevel=ERROR",
|
||||
"-o", "SetEnv=LC_ALL="}
|
||||
}
|
||||
|
Reference in New Issue
Block a user