mirror of
https://github.com/containers/podman.git
synced 2025-05-30 23:17:20 +08:00
fix --format {{json .}} output to match docker
`--format json` should not be the same as `--format {{json .}}`, the later should actually run through the go template and thus create one json object per entry instead of an json array. Includes a vendor of c/common@main since it requires a fix from there as well. This matches docker compat. Fixes #16436 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
22
vendor/github.com/containers/common/pkg/ssh/connection_golang.go
generated
vendored
22
vendor/github.com/containers/common/pkg/ssh/connection_golang.go
generated
vendored
@ -10,6 +10,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -289,11 +290,24 @@ func ValidateAndConfigure(uri *url.URL, iden string, insecureIsMachineConnection
|
||||
keyFilePath := filepath.Join(homedir.Get(), ".ssh", "known_hosts")
|
||||
known, err := knownhosts.New(keyFilePath)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
logrus.Warn("please create a known_hosts file. The next time this host is connected to, podman will add it to known_hosts")
|
||||
return nil
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
return err
|
||||
}
|
||||
keyDir := path.Dir(keyFilePath)
|
||||
if _, err := os.Stat(keyDir); errors.Is(err, os.ErrNotExist) {
|
||||
if err := os.Mkdir(keyDir, 0o700); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
k, err := os.OpenFile(keyFilePath, os.O_RDWR|os.O_CREATE, 0o600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
k.Close()
|
||||
known, err = knownhosts.New(keyFilePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
// we need to check if there is an error from reading known hosts for this public key and if there is an error, what is it, and why is it happening?
|
||||
// if it is a key mismatch we want to error since we know the host using another key
|
||||
|
Reference in New Issue
Block a user