Skip to content

Commit

Permalink
manually bind flag values from upstream logs cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo authored and soltysh committed Aug 2, 2018
1 parent 1c47b5d commit 69b9da2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/oc/cli/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,31 @@ func isPipelineBuild(obj runtime.Object) (bool, *buildv1.BuildConfig, bool, *bui
// resource a user requested to view its logs and creates the appropriate logOptions
// object for it.
func (o *LogsOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string) error {
// manually bind all flag values from the upstream command
// TODO: once the upstream command supports binding flags
// by outside callers, this will no longer be needed.
o.KubeLogOptions.AllContainers = kcmdutil.GetFlagBool(cmd, "all-containers")
o.KubeLogOptions.Container = kcmdutil.GetFlagString(cmd, "container")
o.KubeLogOptions.Selector = kcmdutil.GetFlagString(cmd, "selector")
o.KubeLogOptions.Follow = kcmdutil.GetFlagBool(cmd, "follow")
o.KubeLogOptions.Previous = kcmdutil.GetFlagBool(cmd, "previous")
o.KubeLogOptions.Timestamps = kcmdutil.GetFlagBool(cmd, "timestamps")
o.KubeLogOptions.SinceTime = kcmdutil.GetFlagString(cmd, "since-time")
o.KubeLogOptions.LimitBytes = kcmdutil.GetFlagInt64(cmd, "limit-bytes")
o.KubeLogOptions.Tail = kcmdutil.GetFlagInt64(cmd, "tail")
o.KubeLogOptions.SinceSeconds = kcmdutil.GetFlagDuration(cmd, "since")
o.KubeLogOptions.ContainerNameSpecified = cmd.Flag("container").Changed

if err := o.KubeLogOptions.Complete(f, cmd, args); err != nil {
return err
}

var err error
o.KubeLogOptions.GetPodTimeout, err = kcmdutil.GetPodRunningTimeoutFlag(cmd)
if err != nil {
return err
}

o.Namespace, _, err = f.ToRawKubeConfigLoader().Namespace()
if err != nil {
return err
Expand Down

0 comments on commit 69b9da2

Please sign in to comment.