mirror of
https://github.com/containers/podman.git
synced 2025-06-21 09:28:09 +08:00
expose podman.sock in machine inspect
For consumers of the podman.sock who want a predictable way to find the podman sock, we now include it under 'ConnectionConfig' in podman machine inspect. Fixes: #14231 Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
pkg/machine
@ -138,14 +138,15 @@ type DistributionDownload interface {
|
||||
Get() *Download
|
||||
}
|
||||
type InspectInfo struct {
|
||||
ConfigPath VMFile
|
||||
Created time.Time
|
||||
Image ImageConfig
|
||||
LastUp time.Time
|
||||
Name string
|
||||
Resources ResourceConfig
|
||||
SSHConfig SSHConfig
|
||||
State Status
|
||||
ConfigPath VMFile
|
||||
ConnectionInfo ConnectionConfig
|
||||
Created time.Time
|
||||
Image ImageConfig
|
||||
LastUp time.Time
|
||||
Name string
|
||||
Resources ResourceConfig
|
||||
SSHConfig SSHConfig
|
||||
State Status
|
||||
}
|
||||
|
||||
func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url.URL {
|
||||
@ -286,11 +287,11 @@ func NewMachineFile(path string, symlink *string) (*VMFile, error) {
|
||||
// makeSymlink for macOS creates a symlink in $HOME/.podman/
|
||||
// for a machinefile like a socket
|
||||
func (m *VMFile) makeSymlink(symlink *string) error {
|
||||
homedir, err := os.UserHomeDir()
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sl := filepath.Join(homedir, ".podman", *symlink)
|
||||
sl := filepath.Join(homeDir, ".podman", *symlink)
|
||||
// make the symlink dir and throw away if it already exists
|
||||
if err := os.MkdirAll(filepath.Dir(sl), 0700); err != nil && !errors2.Is(err, os.ErrNotExist) {
|
||||
return err
|
||||
@ -335,3 +336,9 @@ type SSHConfig struct {
|
||||
// RemoteUsername of the vm user
|
||||
RemoteUsername string
|
||||
}
|
||||
|
||||
// ConnectionConfig contains connections like sockets, etc.
|
||||
type ConnectionConfig struct {
|
||||
// PodmanSocket is the exported podman service socket
|
||||
PodmanSocket *VMFile `json:"PodmanSocket"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user