Initial support for native docker client
This commit updates the implementation to use a native docker client as opposed to calling an external executable.
This commit is contained in:
parent
2ee8dfaaec
commit
1855090f26
9 changed files with 379 additions and 58 deletions
|
|
@ -2,19 +2,18 @@ package barrel
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/status"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
|
||||
)
|
||||
|
||||
// Running checks if this WissKI is currently running.
|
||||
func (barrel *Barrel) Running(ctx context.Context, progress io.Writer) (bool, error) {
|
||||
ps, err := barrel.Stack().Ps(ctx, progress)
|
||||
func (barrel *Barrel) Running(ctx context.Context) (bool, error) {
|
||||
containers, err := barrel.Docker.Containers(ctx, barrel.Stack().Dir)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return len(ps) > 0, nil
|
||||
return len(containers) > 0, nil
|
||||
}
|
||||
|
||||
type RunningFetcher struct {
|
||||
|
|
@ -29,6 +28,6 @@ var (
|
|||
)
|
||||
|
||||
func (rf *RunningFetcher) Fetch(flags ingredient.FetcherFlags, info *status.WissKI) (err error) {
|
||||
info.Running, err = rf.Dependencies.Barrel.Running(flags.Context, io.Discard)
|
||||
info.Running, err = rf.Dependencies.Barrel.Running(flags.Context)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue