|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
package composeplugin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/portainer/portainer/pkg/libstack"
|
|
|
|
@ -107,6 +109,7 @@ func (wrapper *PluginWrapper) WaitForStatus(ctx context.Context, name string, st
|
|
|
|
|
errorMessageCh := make(chan string)
|
|
|
|
|
|
|
|
|
|
go func() {
|
|
|
|
|
OUTER:
|
|
|
|
|
for {
|
|
|
|
|
select {
|
|
|
|
|
case <-ctx.Done():
|
|
|
|
@ -135,13 +138,23 @@ func (wrapper *PluginWrapper) WaitForStatus(ctx context.Context, name string, st
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var services []service
|
|
|
|
|
err = json.Unmarshal(output, &services)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Debug().
|
|
|
|
|
Str("project_name", name).
|
|
|
|
|
Err(err).
|
|
|
|
|
Msg("failed to parse docker compose output")
|
|
|
|
|
continue
|
|
|
|
|
dec := json.NewDecoder(bytes.NewReader(output))
|
|
|
|
|
for {
|
|
|
|
|
var svc service
|
|
|
|
|
|
|
|
|
|
err := dec.Decode(&svc)
|
|
|
|
|
if err == io.EOF {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Debug().
|
|
|
|
|
Str("project_name", name).
|
|
|
|
|
Err(err).
|
|
|
|
|
Msg("failed to parse docker compose output")
|
|
|
|
|
continue OUTER
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
services = append(services, svc)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(services) == 0 && status == libstack.StatusRemoved {
|
|
|
|
|