diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-04-16 06:25:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-16 06:25:41 -0700 |
commit | 713839cf8393bdb96c739cb745e403cf2a3a1327 (patch) | |
tree | 5ae1609e0372f6cd4d1b87df93fa0358c47900eb /cmd/podman/cliconfig | |
parent | c1e2b583c82261639d6927c9b2a4f19d87a166a7 (diff) | |
parent | 6fb0a706af438778dd372d4b05b417fb30a45965 (diff) | |
download | podman-713839cf8393bdb96c739cb745e403cf2a3a1327.tar.gz podman-713839cf8393bdb96c739cb745e403cf2a3a1327.tar.bz2 podman-713839cf8393bdb96c739cb745e403cf2a3a1327.zip |
Merge pull request #2946 from baude/segs
Fix segfaults attribute to missing options
Diffstat (limited to 'cmd/podman/cliconfig')
-rw-r--r-- | cmd/podman/cliconfig/commands.go | 36 | ||||
-rw-r--r-- | cmd/podman/cliconfig/config.go | 1 |
2 files changed, 28 insertions, 9 deletions
diff --git a/cmd/podman/cliconfig/commands.go b/cmd/podman/cliconfig/commands.go index 00b66e32a..f6d92611f 100644 --- a/cmd/podman/cliconfig/commands.go +++ b/cmd/podman/cliconfig/commands.go @@ -26,7 +26,9 @@ func (p *PodmanCommand) IsSet(opt string) bool { func (p *PodmanCommand) Bool(opt string) bool { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return false } val, err := p.Flags().GetBool(opt) @@ -40,7 +42,9 @@ func (p *PodmanCommand) Bool(opt string) bool { func (p *PodmanCommand) String(opt string) string { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return "" } val, err := p.Flags().GetString(opt) @@ -54,7 +58,9 @@ func (p *PodmanCommand) String(opt string) string { func (p *PodmanCommand) StringArray(opt string) []string { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return []string{} } val, err := p.Flags().GetStringArray(opt) @@ -68,7 +74,9 @@ func (p *PodmanCommand) StringArray(opt string) []string { func (p *PodmanCommand) StringSlice(opt string) []string { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return []string{} } val, err := p.Flags().GetStringSlice(opt) @@ -82,7 +90,9 @@ func (p *PodmanCommand) StringSlice(opt string) []string { func (p *PodmanCommand) Int(opt string) int { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetInt(opt) @@ -96,7 +106,9 @@ func (p *PodmanCommand) Int(opt string) int { func (p *PodmanCommand) Uint(opt string) uint { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetUint(opt) @@ -110,7 +122,9 @@ func (p *PodmanCommand) Uint(opt string) uint { func (p *PodmanCommand) Int64(opt string) int64 { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetInt64(opt) @@ -124,7 +138,9 @@ func (p *PodmanCommand) Int64(opt string) int64 { func (p *PodmanCommand) Uint64(opt string) uint64 { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetUint64(opt) @@ -138,7 +154,9 @@ func (p *PodmanCommand) Uint64(opt string) uint64 { func (p *PodmanCommand) Float64(opt string) float64 { flag := p.Flags().Lookup(opt) if flag == nil { - logrus.Errorf("Could not find flag %s", opt) + if !p.Remote { + logrus.Errorf("Could not find flag %s", opt) + } return 0 } val, err := p.Flags().GetFloat64(opt) diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go index 2692ace36..982c77c17 100644 --- a/cmd/podman/cliconfig/config.go +++ b/cmd/podman/cliconfig/config.go @@ -8,6 +8,7 @@ type PodmanCommand struct { *cobra.Command InputArgs []string GlobalFlags MainFlags + Remote bool } type MainFlags struct { |