Files
dokku/plugins/apps/triggers.go
Jose Diaz-Gonzalez d7b23b84f0 fix: allow renaming old applications to new format
0.22.0 changed allowed values for app names, making it more difficult for users to fix their app names - you need to either downgrade+rename or recreate the app. The `apps:rename`  command can now rename these old applications to the new standard.

Also drop some app name verification from internal commands. Duplicate verification doesn't help much, and though it isn't excessively slow, it does prevent us from running commands against old apps that exist.

Refs #4267
2020-12-22 13:29:32 -05:00

46 lines
1.0 KiB
Go

package apps
import (
"github.com/dokku/dokku/plugins/common"
)
// TriggerAppCreate is a trigger to create an app
func TriggerAppCreate(appName string) error {
return createApp(appName)
}
// TriggerAppDestroy is a trigger to destroy an app
func TriggerAppDestroy(appName string) error {
return destroyApp(appName)
}
// TriggerAppExists is a trigger to check if an app exists
func TriggerAppExists(appName string) error {
return appExists(appName)
}
// TriggerAppMaybeCreate is a trigger to allow gated app creation
func TriggerAppMaybeCreate(appName string) error {
return maybeCreateApp(appName)
}
// TriggerPostDelete is the apps post-delete plugin trigger
func TriggerPostDelete(appName string) error {
imageRepo := common.GetAppImageRepo(appName)
imagesByAppLabel, err := listImagesByAppLabel(appName)
if err != nil {
common.LogWarn(err.Error())
}
imagesByRepo, err := listImagesByImageRepo(imageRepo)
if err != nil {
common.LogWarn(err.Error())
}
images := append(imagesByAppLabel, imagesByRepo...)
common.RemoveImages(images)
return nil
}