fix: do not delete the destination scale file if it was not extracted previously

This commit is contained in:
Jose Diaz-Gonzalez
2020-11-07 13:05:10 -05:00
parent bf84405b43
commit db435c40e5
2 changed files with 8 additions and 3 deletions

View File

@@ -52,10 +52,14 @@ func extractProcfile(appName, image string, procfilePath string) error {
func extractOrGenerateScalefile(appName string, image string) error {
destination := getScalefilePath(appName)
extracted := getScalefileExtractedPath(appName)
if err := common.CopyFromImage(appName, image, "DOKKU_SCALE", destination); err != nil {
previouslyExtracted := common.FileExists(extracted)
if err := common.CopyFromImage(appName, image, "DOKKU_SCALE", extracted); err != nil {
if previouslyExtracted {
os.Remove(destination)
}
os.Remove(extracted)
os.Remove(destination)
} else if err := common.CopyFile(destination, extracted); err != nil {
} else if err := common.CopyFile(extracted, destination); err != nil {
return err
}

View File

@@ -132,6 +132,7 @@ func TriggerPreDeploy(appName string, imageTag string) error {
if err := extractProcfile(appName, image, procfilePath); err != nil {
return err
}
if err := extractOrGenerateScalefile(appName, imageTag); err != nil {
return err
}