summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/inspect/inspect.go21
-rw-r--r--cmd/podman/play/kube.go5
-rw-r--r--cmd/podman/system/service_abi.go27
3 files changed, 17 insertions, 36 deletions
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go
index f9bd75c93..13f36ebbd 100644
--- a/cmd/podman/inspect/inspect.go
+++ b/cmd/podman/inspect/inspect.go
@@ -2,6 +2,7 @@ package inspect
import (
"context"
+ "encoding/json" // due to a bug in json-iterator it cannot be used here
"fmt"
"os"
"regexp"
@@ -28,17 +29,14 @@ const (
ContainerType = "container"
// ImageType is the image type.
ImageType = "image"
- //NetworkType is the network type
+ // NetworkType is the network type
NetworkType = "network"
- //PodType is the pod type.
+ // PodType is the pod type.
PodType = "pod"
- //VolumeType is the volume type
+ // VolumeType is the volume type
VolumeType = "volume"
)
-// Pull in configured json library
-var json = registry.JSONLibrary()
-
// AddInspectFlagSet takes a command and adds the inspect flags and returns an
// InspectOptions object.
func AddInspectFlagSet(cmd *cobra.Command) *entities.InspectOptions {
@@ -173,7 +171,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
data = append(data, podData)
}
}
- if i.podOptions.Latest { //latest means there are no names in the namesOrID array
+ if i.podOptions.Latest { // latest means there are no names in the namesOrID array
podData, err := i.containerEngine.PodInspect(ctx, i.podOptions)
if err != nil {
cause := errors.Cause(err)
@@ -238,9 +236,12 @@ func (i *inspector) inspect(namesOrIDs []string) error {
}
func printJSON(data []interface{}) error {
- enc := json.NewEncoder(os.Stdout)
- enc.SetIndent("", " ")
- return enc.Encode(data)
+ buf, err := json.MarshalIndent(data, "", " ")
+ if err != nil {
+ return err
+ }
+ _, err = fmt.Println(string(buf))
+ return err
}
func printTmpl(typ, row string, data []interface{}) error {
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index a9e91bd68..db70ad7d4 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -22,6 +22,7 @@ type playKubeOptionsWrapper struct {
TLSVerifyCLI bool
CredentialsCLI string
+ StartCLI bool
}
var (
@@ -68,6 +69,7 @@ func init() {
flags.BoolVarP(&kubeOptions.Quiet, "quiet", "q", false, "Suppress output information when pulling images")
flags.BoolVar(&kubeOptions.TLSVerifyCLI, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries")
+ flags.BoolVar(&kubeOptions.StartCLI, "start", true, "Start the pod after creating it")
authfileFlagName := "authfile"
flags.StringVar(&kubeOptions.Authfile, authfileFlagName, auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
@@ -100,6 +102,9 @@ func kube(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("tls-verify") {
kubeOptions.SkipTLSVerify = types.NewOptionalBool(!kubeOptions.TLSVerifyCLI)
}
+ if cmd.Flags().Changed("start") {
+ kubeOptions.Start = types.NewOptionalBool(kubeOptions.StartCLI)
+ }
if kubeOptions.Authfile != "" {
if _, err := os.Stat(kubeOptions.Authfile); err != nil {
return err
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 84f9293d4..8c52616be 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -5,12 +5,8 @@ package system
import (
"context"
"net"
- "os"
- "os/signal"
"strings"
- "github.com/containers/podman/v2/cmd/podman/utils"
- "github.com/containers/podman/v2/libpod"
api "github.com/containers/podman/v2/pkg/api/server"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/containers/podman/v2/pkg/domain/infra"
@@ -43,7 +39,7 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
return err
}
- startWatcher(rt)
+ infra.StartWatcher(rt)
server, err := api.NewServerWithSettings(rt, opts.Timeout, listener)
if err != nil {
return err
@@ -60,24 +56,3 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
}
return err
}
-
-// startWatcher starts a new SIGHUP go routine for the current config.
-func startWatcher(rt *libpod.Runtime) {
- // Setup the signal notifier
- ch := make(chan os.Signal, 1)
- signal.Notify(ch, utils.SIGHUP)
-
- go func() {
- for {
- // Block until the signal is received
- logrus.Debugf("waiting for SIGHUP to reload configuration")
- <-ch
- if err := rt.Reload(); err != nil {
- logrus.Errorf("unable to reload configuration: %v", err)
- continue
- }
- }
- }()
-
- logrus.Debugf("registered SIGHUP watcher for config")
-}