virtctl/ssh: Fix missing check when parsing a private key
If a private key is parsed and the returned err is not nil and not
ssh.PassphraseMissingError, a nil Signer would have been returned
erroneously without this change.
@@ -97,10 +97,11 @@ func (o *SSH) tryPrivateKey(methods []ssh.AuthMethod) []ssh.AuthMethod {
signer, err := ssh.ParsePrivateKey(key)
if _, isPassErr := err.(*ssh.PassphraseMissingError); isPassErr {
signer, err = o.parsePrivateKeyWithPassphrase(key)
+ }
if err != nil {
return nil, err
}
- }
+
return []ssh.Signer{signer}, nil
})
