func UnTarHelmChart()

in generatebundlefile/helm.go [71:91]


func UnTarHelmChart(chartRef, chartPath, dest string) error {
	if chartRef == "" || chartPath == "" || dest == "" {
		return fmt.Errorf("empty input value given for UnTarHelmChart")
	}
	_, err := os.Stat(dest)
	if os.IsNotExist(err) {
		if _, err := os.Stat(chartPath); err != nil {
			if err := os.MkdirAll(chartPath, 0o755); err != nil {
				return errors.Wrap(err, "failed to untar (mkdir)")
			}
		} else {
			return errors.Errorf("failed to untar: a file or directory with the name %s already exists", dest)
		}
	} else {
		if err != nil { // Checks directory check errors such as permission issues to read
			return errors.Errorf("failed UnTarHelmChart: %s", err)
		}
	}
	// Untar the files, and create the directory structure
	return chartutil.ExpandFile(dest, chartRef)
}