Unverified Commit 5fb32e70 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #67615 from rphillips/fixes/attach_func_initializer

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. attach: Move the AttachFunc default function to the initializer Fixes a partially constructed AttachOptions **What this PR does / why we need it**: NewAttachOptions partially constructs an AttachOptions structure. The defaultAttachFunc should be set automatically, so the caller can potentially override the default behavior. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /cc @kubernetes/sig-cli-api-reviews
parents 0e31372b 9abe17f0
...@@ -89,7 +89,8 @@ func NewAttachOptions(streams genericclioptions.IOStreams) *AttachOptions { ...@@ -89,7 +89,8 @@ func NewAttachOptions(streams genericclioptions.IOStreams) *AttachOptions {
StreamOptions: StreamOptions{ StreamOptions: StreamOptions{
IOStreams: streams, IOStreams: streams,
}, },
Attach: &DefaultRemoteAttach{}, Attach: &DefaultRemoteAttach{},
AttachFunc: defaultAttachFunc,
} }
} }
...@@ -193,8 +194,6 @@ func (o *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []s ...@@ -193,8 +194,6 @@ func (o *AttachOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []s
} }
o.Config = config o.Config = config
o.AttachFunc = defaultAttachFunc
if o.CommandName == "" { if o.CommandName == "" {
o.CommandName = cmd.CommandPath() o.CommandName = cmd.CommandPath()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment