Simplify chart installable check

The error conveys at least as much information as the boolean.

Signed-off-by: Simon Alling <alling.simon@gmail.com>
pull/8227/head
Simon Alling 6 years ago committed by Vlad Fratila
parent 5cea3a2d3e
commit a805bc0b94

@ -192,8 +192,7 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
return nil, err
}
validInstallableChart, err := isChartInstallable(chartRequested)
if !validInstallableChart {
if err := checkIfInstallable(chartRequested); err != nil {
return nil, err
}
@ -239,15 +238,15 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
return client.Run(chartRequested, vals)
}
// isChartInstallable validates if a chart can be installed
// checkIfInstallable validates if a chart can be installed
//
// Application chart type is only installable
func isChartInstallable(ch *chart.Chart) (bool, error) {
func checkIfInstallable(ch *chart.Chart) error {
switch ch.Metadata.Type {
case "", "application":
return true, nil
return nil
}
return false, errors.Errorf("%s charts are not installable", ch.Metadata.Type)
return errors.Errorf("%s charts are not installable", ch.Metadata.Type)
}
func loadExternalFiles(ch *chart.Chart, exFiles files.ExternalFiles) error {

Loading…
Cancel
Save