From 31d95958d91e927c742c23e84cdad6d49bb4bec9 Mon Sep 17 00:00:00 2001 From: Zaraki Date: Sun, 12 Jan 2020 16:01:36 +0100 Subject: [PATCH] fix: fixed chmod issue with on-init script in pwinit fix: fixed an issue with entrypoint not being parsed properly when a challenges is composed of multiple services --- go/cmd/pwinit/main.go | 4 ++++ go/pkg/pwcompose/compose.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/go/cmd/pwinit/main.go b/go/cmd/pwinit/main.go index 9d947fc75..5e9788ced 100644 --- a/go/cmd/pwinit/main.go +++ b/go/cmd/pwinit/main.go @@ -32,6 +32,10 @@ func main() { } else { log.Print("starting on-init hook") // prepare the challenge + err = os.Chmod("/pwinit/on-init", 0555) + if err != nil { + return errcode.ErrExecuteOnInitHook.Wrap(err) + } cmd := exec.Command("/pwinit/on-init") err = cmd.Run() if err != nil { diff --git a/go/pkg/pwcompose/compose.go b/go/pkg/pwcompose/compose.go index 628f2c985..00eefc39b 100644 --- a/go/pkg/pwcompose/compose.go +++ b/go/pkg/pwcompose/compose.go @@ -273,6 +273,9 @@ func Up( return errcode.ErrDockerAPIImageInspect.Wrap(err) } for name, service := range preparedComposeStruct.Services { + if name != instance.Labels[serviceNameLabel] { + continue + } // find service from compose file of current instance entrypoint := []string{} if len(imageInspect.Config.Entrypoint) > 0 {