From ae1b1c7274bb096f133db5ed8ae25a4ece7066a1 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 21 Nov 2020 21:07:20 -0500 Subject: [PATCH] chore: move function to internal --- plugins/ps/functions.go | 16 ++++++++++++++++ plugins/ps/ps.go | 16 ---------------- plugins/ps/subcommands.go | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/plugins/ps/functions.go b/plugins/ps/functions.go index f95b1f162..e69dd52e6 100644 --- a/plugins/ps/functions.go +++ b/plugins/ps/functions.go @@ -315,6 +315,22 @@ func removeProcfile(appName string) error { return os.Remove(procfile) } +func restorePrep() error { + apps, err := common.DokkuApps() + if err != nil { + common.LogWarn(err.Error()) + return nil + } + + for _, appName := range apps { + if err := common.PlugnTrigger("proxy-clear-config", []string{appName}...); err != nil { + return fmt.Errorf("Error clearing proxy config: %s", err) + } + } + + return nil +} + func scaleReport(appName string) error { scalefilePath := getScalefilePath(appName) lines, err := common.FileToSlice(scalefilePath) diff --git a/plugins/ps/ps.go b/plugins/ps/ps.go index 0131fd368..b6849c189 100644 --- a/plugins/ps/ps.go +++ b/plugins/ps/ps.go @@ -117,22 +117,6 @@ func Restore(appName string) error { return Start(appName) } -func RestorePrep() error { - apps, err := common.DokkuApps() - if err != nil { - common.LogWarn(err.Error()) - return nil - } - - for _, appName := range apps { - if err := common.PlugnTrigger("proxy-clear-config", []string{appName}...); err != nil { - return fmt.Errorf("Error clearing proxy config: %s", err) - } - } - - return nil -} - // Start starts the app func Start(appName string) error { imageTag, _ := common.GetRunningImageTag(appName) diff --git a/plugins/ps/subcommands.go b/plugins/ps/subcommands.go index 1847ab9eb..ab085160d 100644 --- a/plugins/ps/subcommands.go +++ b/plugins/ps/subcommands.go @@ -86,7 +86,7 @@ func CommandRestart(appName string, allApps bool, parallelCount int) error { // CommandRestore starts previously running apps e.g. after reboot func CommandRestore(appName string, allApps bool, parallelCount int) error { if allApps { - if err := RestorePrep(); err != nil { + if err := restorePrep(); err != nil { return err } @@ -96,7 +96,7 @@ func CommandRestore(appName string, allApps bool, parallelCount int) error { if appName == "" { common.LogWarn("Restore specified without app, assuming --all") - if err := RestorePrep(); err != nil { + if err := restorePrep(); err != nil { return err } return common.RunCommandAgainstAllApps(Restore, "restore", parallelCount)