setup connection after displaying client version

parent bda27b6f
...@@ -73,15 +73,6 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { ...@@ -73,15 +73,6 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command {
if !version.showClient && !version.showServer { if !version.showClient && !version.showServer {
version.showClient, version.showServer = true, true version.showClient, version.showServer = true, true
} }
if version.showServer {
// We do this manually instead of in PreRun because we only
// need a tunnel if server version is requested.
err := setupConnection()
if err != nil {
return err
}
}
version.client = ensureHelmClient(version.client)
return version.run() return version.run()
}, },
} }
...@@ -111,6 +102,13 @@ func (v *versionCmd) run() error { ...@@ -111,6 +102,13 @@ func (v *versionCmd) run() error {
return tpl(v.template, data, v.out) return tpl(v.template, data, v.out)
} }
// We do this manually instead of in PreRun because we only
// need a tunnel if server version is requested.
if err := setupConnection(); err != nil {
return err
}
v.client = ensureHelmClient(v.client)
if settings.Debug { if settings.Debug {
k8sVersion, err := getK8sVersion() k8sVersion, err := getK8sVersion()
if err != nil { if err != nil {
......
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