Merge pull request #8277 from bacongobbler/fix-deprecated-warning-on-stdout

fix(cmd): display warnings on stderr
pull/8379/head
Matthew Fisher 5 years ago committed by GitHub
commit 9b90e848ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,6 +56,11 @@ func debug(format string, v ...interface{}) {
} }
} }
func warning(format string, v ...interface{}) {
format = fmt.Sprintf("WARNING: %s\n", format)
fmt.Fprintf(os.Stderr, format, v...)
}
func initKubeLogs() { func initKubeLogs() {
pflag.CommandLine.SetNormalizeFunc(wordSepNormalizeFunc) pflag.CommandLine.SetNormalizeFunc(wordSepNormalizeFunc)
gofs := flag.NewFlagSet("klog", flag.ExitOnError) gofs := flag.NewFlagSet("klog", flag.ExitOnError)

@ -17,7 +17,6 @@ limitations under the License.
package main package main
import ( import (
"fmt"
"io" "io"
"log" "log"
"time" "time"
@ -207,7 +206,7 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
} }
if chartRequested.Metadata.Deprecated { if chartRequested.Metadata.Deprecated {
fmt.Fprintln(out, "WARNING: This chart is deprecated") warning("This chart is deprecated")
} }
if req := chartRequested.Metadata.Dependencies; req != nil { if req := chartRequested.Metadata.Dependencies; req != nil {

@ -1,4 +1,3 @@
WARNING: This chart is deprecated
NAME: aeneas NAME: aeneas
LAST DEPLOYED: Fri Sep 2 22:04:05 1977 LAST DEPLOYED: Fri Sep 2 22:04:05 1977
NAMESPACE: default NAMESPACE: default

@ -148,7 +148,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
} }
if ch.Metadata.Deprecated { if ch.Metadata.Deprecated {
fmt.Fprintln(out, "WARNING: This chart is deprecated") warning("This chart is deprecated")
} }
rel, err := client.Run(args[0], ch, vals) rel, err := client.Run(args[0], ch, vals)

Loading…
Cancel
Save