Return err on absent chart dir while updating dep
Explicitly check if the given chart directory does exist before trying
to stat the `requirements.yaml` file and return a descriptive error if
this is not the case. This provides users more guidance than the stat
error we returned in the past.
package chartsync
import (
+ "errors"
"fmt"
"os"
"os/exec"
@@ -12,8 +13,13 @@ func updateDependencies(chartDir, helmhome string) error {
var hasLockFile bool
// sanity check: does the chart directory exist
+ if chartDir == "" {
+ return errors.New("empty path to chart supplied")
+ }
chartInfo, err := os.Stat(chartDir)
switch {
+ case os.IsNotExist(err):
+ return fmt.Errorf("chart path %s does not exist", chartDir)
case err != nil:
return err
case !chartInfo.IsDir():
