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

This commit is contained in:
Jose Diaz-Gonzalez committed 2020-11-21 20:57:33 -05:00
1 parent bf84405b43
commit db435c40e5
2 files changed
+8 -3

No files matched your search

+7 -3
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 {
os.Remove(extracted)
previouslyExtracted := common.FileExists(extracted)
if err := common.CopyFromImage(appName, image, "DOKKU_SCALE", extracted); err != nil {
if previouslyExtracted {
os.Remove(destination)
} else if err := common.CopyFile(destination, extracted); err != nil {
}
os.Remove(extracted)
} else if err := common.CopyFile(extracted, destination); err != nil {
return err
}
+1
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
}