mirror of
https://github.com/dokku/dokku.git
synced 2026-02-24 04:00:36 +01:00
fix: correct a few stickler errors
This commit is contained in:
@@ -131,7 +131,7 @@ func IsAbsPath(path string) bool {
|
||||
return strings.HasPrefix(path, "/")
|
||||
}
|
||||
|
||||
// ListFiles lists files within a given path that have a given prefix
|
||||
// ListFilesWithPrefix lists files within a given path that have a given prefix
|
||||
func ListFilesWithPrefix(path string, prefix string) []string {
|
||||
names, err := ioutil.ReadDir(path)
|
||||
if err != nil {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SetDockerOptionForPhases sets an option to specified phases
|
||||
func SetDockerOptionForPhases(appName string, phases []string, name string, value string) error {
|
||||
for _, phase := range phases {
|
||||
if err := touchPhaseFile(appName, phase); err != nil {
|
||||
|
||||
@@ -8,8 +8,12 @@ import (
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
// RunInSerial is the default value for whether to run a command in parallel or not
|
||||
// and defaults to -1 (false)
|
||||
const RunInSerial = -1
|
||||
|
||||
// ParallelCommand is a type that declares functions
|
||||
// the ps plugins can execute in parallel
|
||||
type ParallelCommand func(string) error
|
||||
|
||||
var (
|
||||
@@ -19,6 +23,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// RunCommandAgainstAllApps runs a given ParallelCommand against all apps
|
||||
func RunCommandAgainstAllApps(command ParallelCommand, commandName string, runInSerial bool, parallelCount int) error {
|
||||
if runInSerial && parallelCount != RunInSerial {
|
||||
common.LogWarn("Ignoring --parallel value and running in serial mode")
|
||||
@@ -31,11 +36,15 @@ func RunCommandAgainstAllApps(command ParallelCommand, commandName string, runIn
|
||||
return RunCommandAgainstAllAppsInParallel(command, commandName, parallelCount)
|
||||
}
|
||||
|
||||
// RunCommandAgainstAllAppsInParallel runs a given
|
||||
// ParallelCommand against all apps in parallel
|
||||
// TODO: implement me
|
||||
func RunCommandAgainstAllAppsInParallel(command ParallelCommand, commandName string, parallelCount int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RunCommandAgainstAllAppsSerially runs a given
|
||||
// ParallelCommand against all apps in serial
|
||||
func RunCommandAgainstAllAppsSerially(command ParallelCommand, commandName string) error {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
@@ -46,7 +55,7 @@ func RunCommandAgainstAllAppsSerially(command ParallelCommand, commandName strin
|
||||
errorCount := 0
|
||||
for _, appName := range apps {
|
||||
if err = command(appName); err != nil {
|
||||
errorCount += 1
|
||||
errorCount++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
|
||||
// CommandInspect displays a sanitized version of docker inspect for an app
|
||||
func CommandInspect(appName string) error {
|
||||
if appName == "" {
|
||||
return errors.New("Please specify an app to run the command on")
|
||||
@@ -23,6 +24,7 @@ func CommandInspect(appName string) error {
|
||||
return common.PlugnTrigger("scheduler-inspect", []string{scheduler, appName}...)
|
||||
}
|
||||
|
||||
// CommandRebuild rebuilds an app from source
|
||||
func CommandRebuild(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||
if allApps {
|
||||
return RunCommandAgainstAllApps(Rebuild, "rebuild", runInSerial, parallelCount)
|
||||
@@ -62,6 +64,7 @@ func CommandReport(appName string, infoFlag string) error {
|
||||
return ReportSingleApp(appName, infoFlag)
|
||||
}
|
||||
|
||||
// CommandRestart restarts an app
|
||||
func CommandRestart(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||
if allApps {
|
||||
return RunCommandAgainstAllApps(Restart, "restart", runInSerial, parallelCount)
|
||||
@@ -78,16 +81,19 @@ func CommandRestart(appName string, allApps bool, runInSerial bool, parallelCoun
|
||||
return Restart(appName)
|
||||
}
|
||||
|
||||
// CommandRestore starts previously running apps e.g. after reboot
|
||||
// TODO: implement me
|
||||
func CommandRestore(appName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CommandRetire ensures old containers are retired
|
||||
// TODO: implement me
|
||||
func CommandRetire() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CommandScale gets or sets how many instances of a given process to run
|
||||
func CommandScale(appName string, skipDeploy bool, processTuples []string) error {
|
||||
if appName == "" {
|
||||
return errors.New("Please specify an app to run the command on")
|
||||
@@ -126,6 +132,7 @@ func CommandScale(appName string, skipDeploy bool, processTuples []string) error
|
||||
return scaleSet(appName, skipDeploy, processTuples)
|
||||
}
|
||||
|
||||
// CommandSet sets or clears a ps property for an app
|
||||
func CommandSet(appName string, property string, value string) error {
|
||||
if property == "restart-policy" {
|
||||
if !isValidRestartPolicy(value) {
|
||||
@@ -140,6 +147,7 @@ func CommandSet(appName string, property string, value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CommandStart starts an app
|
||||
func CommandStart(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||
if allApps {
|
||||
return RunCommandAgainstAllApps(Start, "start", runInSerial, parallelCount)
|
||||
@@ -156,6 +164,7 @@ func CommandStart(appName string, allApps bool, runInSerial bool, parallelCount
|
||||
return Start(appName)
|
||||
}
|
||||
|
||||
// CommandStop stops an app
|
||||
func CommandStop(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||
if allApps {
|
||||
return RunCommandAgainstAllApps(Stop, "stop", runInSerial, parallelCount)
|
||||
|
||||
Reference in New Issue
Block a user