fix: handle case where deploying app image does not exist
This happens if ps:scale is called before a deploy. Also refactor GetDeployingAppImageName() to return an error as the second return parameter.
This commit is contained in:
@@ -145,7 +145,11 @@ func CommandScale(appName string, skipDeploy bool, processTuples []string) error
|
||||
procfilePath := getProcfilePath(appName)
|
||||
if !common.FileExists(procfilePath) {
|
||||
extract := func() error {
|
||||
image := common.GetDeployingAppImageName(appName, "", "")
|
||||
image, err := common.GetDeployingAppImageName(appName, "", "")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return extractProcfile(appName, image)
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,11 @@ func TriggerPostStop(appName string) error {
|
||||
|
||||
// TriggerPreDeploy ensures an app has an up to date scale file
|
||||
func TriggerPreDeploy(appName string, imageTag string) error {
|
||||
image := common.GetDeployingAppImageName(appName, imageTag, "")
|
||||
image, err := common.GetDeployingAppImageName(appName, imageTag, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := removeProcfile(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -183,7 +187,11 @@ func TriggerProcfileGetCommand(appName string, processType string, port int) err
|
||||
procfilePath := getProcfilePath(appName)
|
||||
if !common.FileExists(procfilePath) {
|
||||
extract := func() error {
|
||||
image := common.GetDeployingAppImageName(appName, "", "")
|
||||
image, err := common.GetDeployingAppImageName(appName, "", "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return extractProcfile(appName, image)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user