refactor: drop extra args from procfile-extract

They were not necessary.
This commit is contained in:
Jose Diaz-Gonzalez
2020-11-01 17:40:26 -05:00
parent 06ce3dfadb
commit f9969a0e61
4 changed files with 14 additions and 20 deletions

View File

@@ -1481,7 +1481,7 @@ curl "https://dokku.me/starting/${APP}" || true
- Description: Extracts a Procfile from a given image to a path
- Invoked by: `internally`
- Arguments: `$APP $IMAGE $FORCE_EXTRACT $PROCFILE_PATH`
- Arguments: `$APP $IMAGE`
- Example:
```shell

View File

@@ -110,10 +110,8 @@ func getPhaseScript(appName string, image string, phase string) (string, error)
// getReleaseCommand extracts the release command from a given app's procfile
func getReleaseCommand(appName string, image string) string {
forceExtract := "true"
err := common.SuppressOutput(func() error {
return common.PlugnTrigger("procfile-extract", []string{appName, image, forceExtract}...)
return common.PlugnTrigger("procfile-extract", []string{appName, image}...)
})
if err != nil {

View File

@@ -54,9 +54,7 @@ func main() {
case "procfile-extract":
appName := flag.Arg(0)
image := flag.Arg(1)
forceExtract := common.ToBool(flag.Arg(2))
procfilePath := flag.Arg(3)
err = ps.TriggerProcfileExtract(appName, image, forceExtract, procfilePath)
err = ps.TriggerProcfileExtract(appName, image)
case "procfile-get-command":
appName := flag.Arg(0)
processType := flag.Arg(1)

View File

@@ -139,21 +139,19 @@ func TriggerPreDeploy(appName string, imageTag string) error {
return nil
}
func TriggerProcfileExtract(appName string, image string, forceExtract bool, procfilePath string) error {
if procfilePath == "" {
directory := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "ps", appName)
if err := os.MkdirAll(directory, 0755); err != nil {
return err
}
if err := common.SetPermissions(directory, 0755); err != nil {
return err
}
procfilePath = getProcfilePath(appName)
func TriggerProcfileExtract(appName string, image string) error {
directory := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "ps", appName)
if err := os.MkdirAll(directory, 0755); err != nil {
return err
}
if forceExtract {
if err := common.SetPermissions(directory, 0755); err != nil {
return err
}
procfilePath := getProcfilePath(appName)
if common.FileExists(procfilePath) {
if err := common.PlugnTrigger("procfile-remove", []string{appName, procfilePath}...); err != nil {
return err
}