fix: correct a few stickler errors
This commit is contained in:
1 parent
b44bc686a1
commit
f558008574
4 files changed
+21
-2
No files matched your search
@@ -131,7 +131,7 @@ func IsAbsPath(path string) bool {
|
|||||||
return strings.HasPrefix(path, "/")
|
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 {
|
func ListFilesWithPrefix(path string, prefix string) []string {
|
||||||
names, err := ioutil.ReadDir(path)
|
names, err := ioutil.ReadDir(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SetDockerOptionForPhases sets an option to specified phases
|
||||||
func SetDockerOptionForPhases(appName string, phases []string, name string, value string) error {
|
func SetDockerOptionForPhases(appName string, phases []string, name string, value string) error {
|
||||||
for _, phase := range phases {
|
for _, phase := range phases {
|
||||||
if err := touchPhaseFile(appName, phase); err != nil {
|
if err := touchPhaseFile(appName, phase); err != nil {
|
||||||
|
|||||||
+10
-1
@@ -8,8 +8,12 @@ import (
|
|||||||
"github.com/dokku/dokku/plugins/common"
|
"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
|
const RunInSerial = -1
|
||||||
|
|
||||||
|
// ParallelCommand is a type that declares functions
|
||||||
|
// the ps plugins can execute in parallel
|
||||||
type ParallelCommand func(string) error
|
type ParallelCommand func(string) error
|
||||||
|
|
||||||
var (
|
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 {
|
func RunCommandAgainstAllApps(command ParallelCommand, commandName string, runInSerial bool, parallelCount int) error {
|
||||||
if runInSerial && parallelCount != RunInSerial {
|
if runInSerial && parallelCount != RunInSerial {
|
||||||
common.LogWarn("Ignoring --parallel value and running in serial mode")
|
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)
|
return RunCommandAgainstAllAppsInParallel(command, commandName, parallelCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RunCommandAgainstAllAppsInParallel runs a given
|
||||||
|
// ParallelCommand against all apps in parallel
|
||||||
// TODO: implement me
|
// TODO: implement me
|
||||||
func RunCommandAgainstAllAppsInParallel(command ParallelCommand, commandName string, parallelCount int) error {
|
func RunCommandAgainstAllAppsInParallel(command ParallelCommand, commandName string, parallelCount int) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RunCommandAgainstAllAppsSerially runs a given
|
||||||
|
// ParallelCommand against all apps in serial
|
||||||
func RunCommandAgainstAllAppsSerially(command ParallelCommand, commandName string) error {
|
func RunCommandAgainstAllAppsSerially(command ParallelCommand, commandName string) error {
|
||||||
apps, err := common.DokkuApps()
|
apps, err := common.DokkuApps()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -46,7 +55,7 @@ func RunCommandAgainstAllAppsSerially(command ParallelCommand, commandName strin
|
|||||||
errorCount := 0
|
errorCount := 0
|
||||||
for _, appName := range apps {
|
for _, appName := range apps {
|
||||||
if err = command(appName); err != nil {
|
if err = command(appName); err != nil {
|
||||||
errorCount += 1
|
errorCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CommandInspect displays a sanitized version of docker inspect for an app
|
||||||
func CommandInspect(appName string) error {
|
func CommandInspect(appName string) error {
|
||||||
if appName == "" {
|
if appName == "" {
|
||||||
return errors.New("Please specify an app to run the command on")
|
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}...)
|
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 {
|
func CommandRebuild(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||||
if allApps {
|
if allApps {
|
||||||
return RunCommandAgainstAllApps(Rebuild, "rebuild", runInSerial, parallelCount)
|
return RunCommandAgainstAllApps(Rebuild, "rebuild", runInSerial, parallelCount)
|
||||||
@@ -62,6 +64,7 @@ func CommandReport(appName string, infoFlag string) error {
|
|||||||
return ReportSingleApp(appName, infoFlag)
|
return ReportSingleApp(appName, infoFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandRestart restarts an app
|
||||||
func CommandRestart(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
func CommandRestart(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||||
if allApps {
|
if allApps {
|
||||||
return RunCommandAgainstAllApps(Restart, "restart", runInSerial, parallelCount)
|
return RunCommandAgainstAllApps(Restart, "restart", runInSerial, parallelCount)
|
||||||
@@ -78,16 +81,19 @@ func CommandRestart(appName string, allApps bool, runInSerial bool, parallelCoun
|
|||||||
return Restart(appName)
|
return Restart(appName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandRestore starts previously running apps e.g. after reboot
|
||||||
// TODO: implement me
|
// TODO: implement me
|
||||||
func CommandRestore(appName string) error {
|
func CommandRestore(appName string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandRetire ensures old containers are retired
|
||||||
// TODO: implement me
|
// TODO: implement me
|
||||||
func CommandRetire() error {
|
func CommandRetire() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandScale gets or sets how many instances of a given process to run
|
||||||
func CommandScale(appName string, skipDeploy bool, processTuples []string) error {
|
func CommandScale(appName string, skipDeploy bool, processTuples []string) error {
|
||||||
if appName == "" {
|
if appName == "" {
|
||||||
return errors.New("Please specify an app to run the command on")
|
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)
|
return scaleSet(appName, skipDeploy, processTuples)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandSet sets or clears a ps property for an app
|
||||||
func CommandSet(appName string, property string, value string) error {
|
func CommandSet(appName string, property string, value string) error {
|
||||||
if property == "restart-policy" {
|
if property == "restart-policy" {
|
||||||
if !isValidRestartPolicy(value) {
|
if !isValidRestartPolicy(value) {
|
||||||
@@ -140,6 +147,7 @@ func CommandSet(appName string, property string, value string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandStart starts an app
|
||||||
func CommandStart(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
func CommandStart(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||||
if allApps {
|
if allApps {
|
||||||
return RunCommandAgainstAllApps(Start, "start", runInSerial, parallelCount)
|
return RunCommandAgainstAllApps(Start, "start", runInSerial, parallelCount)
|
||||||
@@ -156,6 +164,7 @@ func CommandStart(appName string, allApps bool, runInSerial bool, parallelCount
|
|||||||
return Start(appName)
|
return Start(appName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandStop stops an app
|
||||||
func CommandStop(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
func CommandStop(appName string, allApps bool, runInSerial bool, parallelCount int) error {
|
||||||
if allApps {
|
if allApps {
|
||||||
return RunCommandAgainstAllApps(Stop, "stop", runInSerial, parallelCount)
|
return RunCommandAgainstAllApps(Stop, "stop", runInSerial, parallelCount)
|
||||||
|
|||||||
Reference in new issue
Block a user