Check that chart exists when updating its deps
We don't want to fail at updating chart dependencies when a chart
doesn't have a requirements.yaml file (which is optional, for a
chart). However, we _do_ want to fail if the chart doesn't exist in
the filesystem at all.
@@ -11,6 +11,15 @@ import (
func updateDependencies(chartDir, helmhome string) error {
var hasLockFile bool
+ // sanity check: does the chart directory exist
+ chartInfo, err := os.Stat(chartDir)
+ switch {
+ case err != nil:
+ return err
+ case !chartInfo.IsDir():
+ return fmt.Errorf("chart path %s is not a directory", chartDir)
+ }
+
// check if the requirements file exists
reqFilePath := filepath.Join(chartDir, "requirements.yaml")
reqInfo, err := os.Stat(reqFilePath)
