setup connection after displaying client version

pull/4410/head
Matthew Fisher 6 years ago
parent bda27b6f2a
commit a7ab81f8e7
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

@ -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 {
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 {

Loading…
Cancel
Save