fix: unify IsImageHerokuishBased with shell version
Really we should just spit this out into a bin and then have the shell version wrap the golang ones...
This commit is contained in:
@@ -274,7 +274,27 @@ func IsImageCnbBased(image string) bool {
|
|||||||
|
|
||||||
// IsImageHerokuishBased returns true if app image is based on herokuish
|
// IsImageHerokuishBased returns true if app image is based on herokuish
|
||||||
func IsImageHerokuishBased(image string, appName string) bool {
|
func IsImageHerokuishBased(image string, appName string) bool {
|
||||||
output, err := DockerInspect(image, "{{range .Config.Env}}{{if eq . \"USER=herokuishuser\" }}{{println .}}{{end}}{{end}}")
|
if len(image) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if IsImageCnbBased(image) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
dokkuAppUser := ""
|
||||||
|
if len(appName) != 0 {
|
||||||
|
b, err := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_USER"}...)
|
||||||
|
if err == nil {
|
||||||
|
dokkuAppUser = strings.TrimSpace(string(b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(dokkuAppUser) == 0 {
|
||||||
|
dokkuAppUser = "herokuishuser"
|
||||||
|
}
|
||||||
|
|
||||||
|
output, err := DockerInspect(image, fmt.Sprintf("{{range .Config.Env}}{{if eq . \"USER=%s\" }}{{println .}}{{end}}{{end}}", dokkuAppUser))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user