mirror of
https://github.com/dokku/dokku.git
synced 2026-02-24 04:00:36 +01:00
refactor: drop extra internal calls to VerifyAppName
These are duplicative of the checks that happen at the subcommand level.
This commit is contained in:
@@ -44,10 +44,6 @@ func createApp(appName string) error {
|
||||
|
||||
// destroys an app
|
||||
func destroyApp(appName string) error {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if os.Getenv("DOKKU_APPS_FORCE_DELETE") != "1" {
|
||||
if err := common.AskForDestructiveConfirmation(appName, "app"); err != nil {
|
||||
return err
|
||||
|
||||
@@ -90,10 +90,6 @@ func GetGlobalScheduler() string {
|
||||
|
||||
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
|
||||
func GetDeployingAppImageName(appName, imageTag, imageRepo string) (string, error) {
|
||||
if appName == "" {
|
||||
LogFail("(GetDeployingAppImageName) APP must not be empty")
|
||||
}
|
||||
|
||||
b, err := PlugnTriggerOutput("deployed-app-repository", []string{appName}...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -140,10 +136,6 @@ func GetAppImageRepo(appName string) string {
|
||||
// GetAppContainerIDs returns a list of docker container ids for given app and optional container_type
|
||||
func GetAppContainerIDs(appName string, containerType string) ([]string, error) {
|
||||
var containerIDs []string
|
||||
if err := VerifyAppName(appName); err != nil {
|
||||
return containerIDs, err
|
||||
}
|
||||
|
||||
appRoot := AppRoot(appName)
|
||||
containerFilePath := fmt.Sprintf("%v/CONTAINER", appRoot)
|
||||
_, err := os.Stat(containerFilePath)
|
||||
@@ -170,10 +162,6 @@ func GetAppContainerIDs(appName string, containerType string) ([]string, error)
|
||||
// GetAppRunningContainerIDs return a list of running docker container ids for given app and optional container_type
|
||||
func GetAppRunningContainerIDs(appName string, containerType string) ([]string, error) {
|
||||
var runningContainerIDs []string
|
||||
if err := VerifyAppName(appName); err != nil {
|
||||
return runningContainerIDs, err
|
||||
}
|
||||
|
||||
if !IsDeployed(appName) {
|
||||
LogFail(fmt.Sprintf("App %v has not been deployed", appName))
|
||||
}
|
||||
@@ -193,10 +181,6 @@ func GetAppRunningContainerIDs(appName string, containerType string) ([]string,
|
||||
|
||||
// GetRunningImageTag retrieves current image tag for a given app and returns empty string if no deployed containers are found
|
||||
func GetRunningImageTag(appName string) (string, error) {
|
||||
if err := VerifyAppName(appName); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
containerIDs, err := GetAppContainerIDs(appName, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -241,11 +225,6 @@ func DokkuApps() (apps []string, err error) {
|
||||
|
||||
// GetAppImageName returns image identifier for a given app, tag tuple. validate if tag is presented
|
||||
func GetAppImageName(appName, imageTag, imageRepo string) (imageName string) {
|
||||
err := VerifyAppName(appName)
|
||||
if err != nil {
|
||||
LogFail(err.Error())
|
||||
}
|
||||
|
||||
if imageRepo == "" {
|
||||
imageRepo = GetAppImageRepo(appName)
|
||||
}
|
||||
|
||||
@@ -22,10 +22,6 @@ func ContainerIsRunning(containerID string) bool {
|
||||
|
||||
// CopyFromImage copies a file from named image to destination
|
||||
func CopyFromImage(appName string, image string, source string, destination string) error {
|
||||
if err := VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !VerifyImage(image) {
|
||||
return fmt.Errorf("Invalid docker image for copying content")
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ var (
|
||||
|
||||
// BuildConfig builds network config files
|
||||
func BuildConfig(appName string) error {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !common.IsDeployed(appName) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -104,14 +104,6 @@ func TriggerNetworkGetProperty(appName string, property string) {
|
||||
|
||||
// TriggerNetworkWriteIpaddr writes the ip to disk
|
||||
func TriggerNetworkWriteIpaddr(appName string, processType string, containerIndex string, ip string) {
|
||||
if appName == "" {
|
||||
common.LogFail("Please specify an app to run the command on")
|
||||
}
|
||||
err := common.VerifyAppName(appName)
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
|
||||
appRoot := common.AppRoot(appName)
|
||||
filename := fmt.Sprintf("%v/IP.%v.%v", appRoot, processType, containerIndex)
|
||||
f, err := os.Create(filename)
|
||||
@@ -129,14 +121,6 @@ func TriggerNetworkWriteIpaddr(appName string, processType string, containerInde
|
||||
|
||||
// TriggerNetworkWritePort writes the port to disk
|
||||
func TriggerNetworkWritePort(appName string, processType string, containerIndex string, port string) {
|
||||
if appName == "" {
|
||||
common.LogFail("Please specify an app to run the command on")
|
||||
}
|
||||
err := common.VerifyAppName(appName)
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
|
||||
appRoot := common.AppRoot(appName)
|
||||
filename := fmt.Sprintf("%v/PORT.%v.%v", appRoot, processType, containerIndex)
|
||||
f, err := os.Create(filename)
|
||||
|
||||
@@ -35,11 +35,6 @@ func inRange(value int, min int, max int) bool {
|
||||
|
||||
// IsAppProxyEnabled returns true if proxy is enabled; otherwise return false
|
||||
func IsAppProxyEnabled(appName string) bool {
|
||||
err := common.VerifyAppName(appName)
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
}
|
||||
|
||||
proxyEnabled := true
|
||||
disableProxy := config.GetWithDefault(appName, "DOKKU_DISABLE_PROXY", "")
|
||||
if disableProxy != "" {
|
||||
|
||||
@@ -11,11 +11,6 @@ import (
|
||||
|
||||
// PurgeCache deletes the contents of the build cache stored in the repository
|
||||
func PurgeCache(appName string) error {
|
||||
err := common.VerifyAppName(appName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cacheDir := strings.Join([]string{common.AppRoot(appName), "cache"}, "/")
|
||||
cacheHostDir := strings.Join([]string{common.AppHostRoot(appName), "cache"}, "/")
|
||||
dokkuGlobalRunArgs := common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS")
|
||||
|
||||
Reference in New Issue
Block a user