refactor: drop extra internal calls to VerifyAppName

These are duplicative of the checks that happen at the subcommand level.
This commit is contained in:
Jose Diaz-Gonzalez
2020-12-25 00:08:52 -05:00
parent e0570be562
commit 65d7fd9cce
7 changed files with 0 additions and 59 deletions

View File

@@ -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

View File

@@ -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)
}

View File

@@ -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")
}

View File

@@ -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
}

View File

@@ -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)

View File

@@ -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 != "" {

View File

@@ -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")