|
|
|
@ -109,13 +109,18 @@ func (p *Pull) Run(chartRef string) (string, error) {
|
|
|
|
|
if !filepath.IsAbs(ud) {
|
|
|
|
|
ud = filepath.Join(p.DestDir, ud)
|
|
|
|
|
}
|
|
|
|
|
if _, err := os.Stat(ud); err != nil {
|
|
|
|
|
if err := os.MkdirAll(ud, 0755); err != nil {
|
|
|
|
|
// Let udCheck to check conflict file/dir without replacing ud when untarDir is .
|
|
|
|
|
udCheck := ud
|
|
|
|
|
if udCheck == "." {
|
|
|
|
|
_, udCheck = filepath.Split(chartRef)
|
|
|
|
|
}
|
|
|
|
|
if _, err := os.Stat(udCheck); err != nil {
|
|
|
|
|
if err := os.MkdirAll(udCheck, 0755); err != nil {
|
|
|
|
|
return out.String(), errors.Wrap(err, "failed to untar (mkdir)")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if ud != "." {
|
|
|
|
|
return out.String(), errors.Errorf("failed to untar: a file or directory with the name %s already exists", ud)
|
|
|
|
|
} else {
|
|
|
|
|
return out.String(), errors.Errorf("failed to untar: a file or directory with the name %s already exists", udCheck)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return out.String(), chartutil.ExpandFile(ud, saved)
|
|
|
|
|