Skip to content
This repository was archived by the owner on Feb 3, 2019. It is now read-only.

Commit dd26068

Browse files
author
deissh
committed
добавил получение активных функций
1 parent 1e4b9e7 commit dd26068

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Gopkg.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/manager/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func main() {
1010

1111
m, _ := manager.Create()
1212

13-
active, err := m.GetAll()
13+
active, err := m.GetActive()
1414
if err != nil {
1515
log.Panic(err)
1616
}

pkg/manager/list.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,26 @@ package manager
33
import (
44
"github.com/docker/docker/api/types"
55
"golang.org/x/net/context"
6+
"log"
67
)
78

89
func (m *Core) GetAll() ([]types.Container, error) {
910
res, err := m.client.ContainerList(context.Background(), types.ContainerListOptions{})
1011
return res, err
1112
}
13+
14+
func (m *Core) GetActive() ([]types.Container, error) {
15+
containers, err := m.client.ContainerList(context.Background(), types.ContainerListOptions{})
16+
if err != nil {
17+
log.Fatalln(err)
18+
}
19+
20+
var res []types.Container
21+
for _, container := range containers{
22+
if _, ok := container.Labels["LAMBDA_UUID"]; ok {
23+
res = append(res, container)
24+
}
25+
}
26+
27+
return res, err
28+
}

0 commit comments

Comments
 (0)