diff options
-rwxr-xr-x | API.md | 15 | ||||
-rw-r--r-- | cmd/podman/common.go | 8 | ||||
-rw-r--r-- | cmd/podman/main_local.go | 6 | ||||
-rw-r--r-- | cmd/podman/varlink/io.podman.varlink | 10 | ||||
-rw-r--r-- | completions/zsh/_podman | 19 | ||||
-rw-r--r-- | libpod/networking_linux.go | 1 | ||||
-rw-r--r-- | libpod/oci_conmon_linux.go | 9 | ||||
-rw-r--r-- | pkg/adapter/info_remote.go | 14 | ||||
-rw-r--r-- | pkg/rootlessport/rootlessport_linux.go | 4 | ||||
-rw-r--r-- | pkg/varlinkapi/system.go | 29 | ||||
-rw-r--r-- | test/e2e/info_test.go | 2 |
11 files changed, 66 insertions, 51 deletions
@@ -237,6 +237,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [type InfoPodmanBinary](#InfoPodmanBinary) +[type InfoRegistry](#InfoRegistry) + [type InfoStore](#InfoStore) [type KubePodService](#KubePodService) @@ -1850,6 +1852,15 @@ go_version [string](https://godoc.org/builtin#string) podman_version [string](https://godoc.org/builtin#string) git_commit [string](https://godoc.org/builtin#string) +### <a name="InfoRegistry"></a>type InfoRegistry + +InfoRegistry describes the host's registry information + +search [[]string](#[]string) + +insecure [[]string](#[]string) + +blocked [[]string](#[]string) ### <a name="InfoStore"></a>type InfoStore InfoStore describes the host's storage informatoin @@ -1962,9 +1973,7 @@ PodmanInfo describes the Podman host and build host [InfoHost](#InfoHost) -registries [[]string](#[]string) - -insecure_registries [[]string](#[]string) +registries [InfoRegistry](#InfoRegistry) store [InfoStore](#InfoStore) diff --git a/cmd/podman/common.go b/cmd/podman/common.go index 69365201e..dc7590590 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -308,7 +308,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.String( "image-volume", cliconfig.DefaultImageVolume, - "Tells podman how to handle the builtin image volumes. The options are: 'bind', 'tmpfs', or 'ignore'", + `Tells podman how to handle the builtin image volumes ("bind"|"tmpfs"|"ignore")`, ) createFlags.Bool( "init", false, @@ -431,7 +431,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.String( "pull", "missing", - `Pull image before creating ("always"|"missing"|"never") (default "missing")`, + `Pull image before creating ("always"|"missing"|"never")`, ) createFlags.BoolP( "quiet", "q", false, @@ -447,7 +447,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.String( "restart", "", - "Restart policy to apply when a container exits", + `Restart policy to apply when a container exits ("always"|"no"|"on-failure")`, ) createFlags.Bool( "rm", false, @@ -492,7 +492,7 @@ func getCreateFlags(c *cliconfig.PodmanCommand) { ) createFlags.String( "systemd", "true", - `Run container in systemd mode ("true"|"false"|"always" (default "true")`, + `Run container in systemd mode ("true"|"false"|"always")`, ) createFlags.StringArray( "tmpfs", []string{}, diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go index bc46e4652..e5b87754b 100644 --- a/cmd/podman/main_local.go +++ b/cmd/podman/main_local.go @@ -33,7 +33,7 @@ const remote = false func init() { cgroupManager := define.SystemdCgroupsManager - cgroupHelp := "Cgroup manager to use (cgroupfs or systemd)" + cgroupHelp := `Cgroup manager to use ("cgroupfs"|"systemd")` cgroupv2, _ := cgroups.IsCgroup2UnifiedMode() if rootless.IsRootless() && !cgroupv2 { cgroupManager = "" @@ -50,12 +50,12 @@ func init() { if err := rootCmd.PersistentFlags().MarkHidden("default-mounts-file"); err != nil { logrus.Error("unable to mark default-mounts-file flag as hidden") } - rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.EventsBackend, "events-backend", "", "Events backend to use") + rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.EventsBackend, "events-backend", "", `Events backend to use ("file"|"journald"|"none")`) // Override default --help information of `--help` global flag var dummyHelp bool rootCmd.PersistentFlags().BoolVar(&dummyHelp, "help", false, "Help for podman") rootCmd.PersistentFlags().StringSliceVar(&MainGlobalOpts.HooksDir, "hooks-dir", []string{}, "Set the OCI hooks directory path (may be set multiple times)") - rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.LogLevel, "log-level", "error", "Log messages above specified level: debug, info, warn, error, fatal or panic") + rootCmd.PersistentFlags().StringVar(&MainGlobalOpts.LogLevel, "log-level", "error", `Log messages above specified level ("debug"|"info"|"warn"|"error"|"fatal"|"panic")`) rootCmd.PersistentFlags().IntVar(&MainGlobalOpts.MaxWorks, "max-workers", 0, "The maximum number of workers for parallel operations") if err := rootCmd.PersistentFlags().MarkHidden("max-workers"); err != nil { logrus.Error("unable to mark max-workers flag as hidden") diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index e1f28d847..ac400a467 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -245,6 +245,13 @@ type InfoGraphStatus ( supports_d_type: string ) +# InfoRegistry describes the host's registry information +type InfoRegistry ( + search: []string, + insecure: []string, + blocked: []string +) + # InfoStore describes the host's storage informatoin type InfoStore ( containers: int, @@ -267,8 +274,7 @@ type InfoPodmanBinary ( # PodmanInfo describes the Podman host and build type PodmanInfo ( host: InfoHost, - registries: []string, - insecure_registries: []string, + registries: InfoRegistry, store: InfoStore, podman: InfoPodmanBinary ) diff --git a/completions/zsh/_podman b/completions/zsh/_podman index 06aa92748..067eebbbb 100644 --- a/completions/zsh/_podman +++ b/completions/zsh/_podman @@ -111,20 +111,13 @@ _podman_find_helper() { elif expr "$desc" : ".*[Pp]ath" >/dev/null; then optval="path" helper=_files - elif [ "$flags" = "--cgroup-manager" ]; then - optval="cgroup manager" - helper="(cgroupfs systemd)" - elif [ "$flags" = "--log-level" ]; then - optval="log level" - # 'Log messages above specified level: debug, ... (default "...")' - # Strip off the description and all 'default' strings - desc=${desc/Log*:/} # debug, info, ... (default "...") - desc=${(S)desc//\(*\)/} # debug, info, ... or panic - desc=${desc//,/} # debug info ... or panic - desc=${desc// or / } # debug info ... panic - desc=${desc// / } # collapse multiple spaces + # For messages like 'restart policy ("always"|"no"|"on-failure") + elif optlist=$(expr "$desc" : '.*(\(\"[^\\)]\+|[^\\)]\+\"\))' 2>/dev/null); then + optval=${${flags##--}//-/ } # "--log-level" => "log level" + optlist=${optlist//\"/} # "a"|"b"|"c" => a|b|c + optlist=${optlist//\|/ } # a|b|c => a b c # FIXME: how to present values _in order_, not sorted alphabetically? - helper="($desc)" + helper="($optlist)" fi echo "$optval:$helper" } diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 06b3fe957..89dac2b5d 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -344,6 +344,7 @@ func (r *Runtime) setupRootlessPortMapping(ctr *Container, netnsPath string) (er NetNSPath: netnsPath, ExitFD: 3, ReadyFD: 4, + TmpDir: ctr.runtime.config.TmpDir, } cfgJSON, err := json.Marshal(cfg) if err != nil { diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index 0312f0ba2..b09dc3a4f 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -546,6 +546,10 @@ func (r *ConmonOCIRuntime) ExecContainer(c *Container, sessionID string, options args = append(args, "-t") } + if options.Streams.AttachInput { + args = append(args, "-i") + } + // Append container ID and command args = append(args, "-e") // TODO make this optional when we can detach @@ -558,9 +562,8 @@ func (r *ConmonOCIRuntime) ExecContainer(c *Container, sessionID string, options execCmd := exec.Command(r.conmonPath, args...) if options.Streams != nil { - if options.Streams.AttachInput { - execCmd.Stdin = options.Streams.InputStream - } + // Don't add the InputStream to the execCmd. Instead, the data should be passed + // through CopyDetachable if options.Streams.AttachOutput { execCmd.Stdout = options.Streams.OutputStream } diff --git a/pkg/adapter/info_remote.go b/pkg/adapter/info_remote.go index 3170e5b3d..c55d1f6ef 100644 --- a/pkg/adapter/info_remote.go +++ b/pkg/adapter/info_remote.go @@ -14,12 +14,11 @@ func (r RemoteRuntime) Info() ([]define.InfoData, error) { // TODO the varlink implementation for info should be updated to match the output for regular info var ( reply []define.InfoData + regInfo map[string]interface{} hostInfo map[string]interface{} store map[string]interface{} ) - registries := make(map[string]interface{}) - insecureRegistries := make(map[string]interface{}) info, err := iopodman.GetInfo().Call(r.Conn) if err != nil { return nil, err @@ -39,13 +38,16 @@ func (r RemoteRuntime) Info() ([]define.InfoData, error) { } json.Unmarshal(s, &store) - registries["registries"] = info.Registries - insecureRegistries["registries"] = info.Insecure_registries + // info.Registries -> map[string]interface{} + reg, err := json.Marshal(info.Registries) + if err != nil { + return nil, err + } + json.Unmarshal(reg, ®Info) // Add everything to the reply reply = append(reply, define.InfoData{Type: "host", Data: hostInfo}) - reply = append(reply, define.InfoData{Type: "registries", Data: registries}) - reply = append(reply, define.InfoData{Type: "insecure registries", Data: insecureRegistries}) + reply = append(reply, define.InfoData{Type: "registries", Data: regInfo}) reply = append(reply, define.InfoData{Type: "store", Data: store}) return reply, nil } diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go index 655d1a448..3e678d33a 100644 --- a/pkg/rootlessport/rootlessport_linux.go +++ b/pkg/rootlessport/rootlessport_linux.go @@ -46,6 +46,7 @@ type Config struct { NetNSPath string ExitFD int ReadyFD int + TmpDir string } func init() { @@ -101,10 +102,11 @@ func parent() error { } // create the parent driver - stateDir, err := ioutil.TempDir("", "rootlessport") + stateDir, err := ioutil.TempDir(cfg.TmpDir, "rootlessport") if err != nil { return err } + defer os.RemoveAll(stateDir) driver, err := rkbuiltin.NewParentDriver(&logrusWriter{prefix: "parent: "}, stateDir) if err != nil { return err diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go index b81ff11ba..50aaaaa44 100644 --- a/pkg/varlinkapi/system.go +++ b/pkg/varlinkapi/system.go @@ -9,6 +9,7 @@ import ( goruntime "runtime" "time" + "github.com/containers/image/v5/pkg/sysregistriesv2" "github.com/containers/libpod/cmd/podman/varlink" "github.com/containers/libpod/libpod/define" "github.com/sirupsen/logrus" @@ -37,9 +38,6 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error { if err != nil { return err } - var ( - registries, insecureRegistries []string - ) podmanInfo := iopodman.PodmanInfo{} info, err := i.Runtime.Info() if err != nil { @@ -90,22 +88,25 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error { Graph_status: graphStatus, } + // Registry information if any is stored as the second list item if len(info) > 2 { - registriesInterface := info[2].Data["registries"] - if registriesInterface != nil { - registries = registriesInterface.([]string) - } - } - if len(info) > 3 { - insecureRegistriesInterface := info[3].Data["registries"] - if insecureRegistriesInterface != nil { - insecureRegistries = insecureRegistriesInterface.([]string) + for key, val := range info[2].Data { + if key == "search" { + podmanInfo.Registries.Search = val.([]string) + continue + } + regData := val.(sysregistriesv2.Registry) + if regData.Insecure { + podmanInfo.Registries.Insecure = append(podmanInfo.Registries.Insecure, key) + } + if regData.Blocked { + podmanInfo.Registries.Blocked = append(podmanInfo.Registries.Blocked, key) + } } + } podmanInfo.Store = infoStore podmanInfo.Podman = pmaninfo - podmanInfo.Registries = registries - podmanInfo.Insecure_registries = insecureRegistries return call.ReplyGetInfo(podmanInfo) } diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index d3b1b974e..d16661d5b 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -1,5 +1,3 @@ -// +build !remoteclient - package integration import ( |