Skip to content

Commit

Permalink
cut down on CLI verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed Jul 15, 2020
1 parent 113109f commit fdfbb03
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion cmd/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ var clusterCmd = &cobra.Command{
panic(err)
}
} else {
fmt.Printf("\n\n")
fmt.Println(out)
}
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ var (

func init() {
klog.InitFlags(nil)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
flag.Set("alsologtostderr", "true")
flag.Set("logtostderr", "true")
flag.Parse()
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
}

var rootCmd = &cobra.Command{
Expand Down
5 changes: 1 addition & 4 deletions pkg/helm/chartrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewRepo(urls []string) []*Repo {
}
err := repo.loadReleases()
if err != nil {
klog.Warningf("Could not load chart repo: %s", address)
klog.V(5).Infof("Could not load chart repo %s: %s", address, err)
} else {
mutex.Lock()
repos = append(repos, repo)
Expand All @@ -82,19 +82,16 @@ func NewRepo(urls []string) []*Repo {
func (r *Repo) loadReleases() error {
response, err := http.Get(fmt.Sprintf("%s/index.yaml", r.URL))
if err != nil {
klog.Warningf("Error loading chart repo %s: %v", r.URL, err)
return err
}

data, err := ioutil.ReadAll(response.Body)
if err != nil {
klog.Warningf("Error reading chart data from repo %s: %v", r.URL, err)
return err
}

err = yaml.Unmarshal(data, r.Charts)
if err != nil {
klog.Warningf("Error unmarshalling yaml for chart repo %s: %v", r.URL, err)
return err
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/helm/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (h *Helm) GetHelmReleasesVersion3(helmRepos []*Repo) ([]output.ReleaseOutpu
return nil, err
}

klog.Infof("Got %d installed releases in the cluster", len(deployed))
klog.V(5).Infof("Got %d installed releases in the cluster", len(deployed))
for _, chart := range deployed {
validRepos := IsRepoIncluded(chart.Chart.Metadata.Name, helmRepos)
newest := TryToFindNewestReleaseByChart(chart, validRepos)
Expand Down Expand Up @@ -78,7 +78,7 @@ func (h *Helm) GetHelmReleasesVersion2(helmRepos []*Repo) ([]output.ReleaseOutpu
return nil, err
}

klog.Infof("Got %d installed releases in the cluster", len(deployed))
klog.V(5).Infof("Got %d installed releases in the cluster", len(deployed))
for _, chart := range deployed {
validRepos := IsRepoIncluded(chart.Chart.Metadata.Name, helmRepos)

Expand Down

0 comments on commit fdfbb03

Please sign in to comment.