mirror of https://github.com/containers/podman.git
image scp: don't require port for ssh URL
SSH uses 22 as default so it is really not necessary to require the port. The backend code already does this but the parsing in the frontend always tried to parse the port. [NO NEW TESTS NEEDED] This would require actual remote host ssh setup in CI so it is not possible to be check but I verified it locally. Fixes https://issues.redhat.com/browse/RHEL-17776 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
2fbf793bdf
commit
41cd90a8e7
|
@ -205,10 +205,15 @@ func LoginUser(user string) (*exec.Cmd, error) {
|
|||
// and copies the saved image dir over to the remote host and then loads it onto the machine
|
||||
// returns a string containing output or an error
|
||||
func LoadToRemote(dest entities.ImageScpOptions, localFile string, tag string, url *url.URL, iden string, sshEngine ssh.EngineMode) (string, string, error) {
|
||||
port, err := strconv.Atoi(url.Port())
|
||||
port := 0
|
||||
urlPort := url.Port()
|
||||
if urlPort != "" {
|
||||
var err error
|
||||
port, err = strconv.Atoi(url.Port())
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
}
|
||||
|
||||
remoteFile, err := ssh.Exec(&ssh.ConnectionExecOptions{Host: url.String(), Identity: iden, Port: port, User: url.User, Args: []string{"mktemp"}}, sshEngine)
|
||||
if err != nil {
|
||||
|
@ -250,10 +255,15 @@ func SaveToRemote(image, localFile string, tag string, uri *url.URL, iden string
|
|||
return fmt.Errorf("renaming of an image is currently not supported: %w", define.ErrInvalidArg)
|
||||
}
|
||||
|
||||
port, err := strconv.Atoi(uri.Port())
|
||||
port := 0
|
||||
urlPort := uri.Port()
|
||||
if urlPort != "" {
|
||||
var err error
|
||||
port, err = strconv.Atoi(uri.Port())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
remoteFile, err := ssh.Exec(&ssh.ConnectionExecOptions{Host: uri.String(), Identity: iden, Port: port, User: uri.User, Args: []string{"mktemp"}}, sshEngine)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue