-
Notifications
You must be signed in to change notification settings - Fork 13
/
millicore.go
33 lines (30 loc) · 1.08 KB
/
millicore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"os/exec"
"path/filepath"
)
// GetMillicoreConfigTasks will create a function matching the CheckTask
// interface for each project to retrieve the Millicore config in that
// property, if the pod exists. The created tasks are sent down the tasks
// channel.
func GetMillicoreConfigTasks(tasks chan<- Task, runner Runner, projects []string, resourceFactory ResourceMatchFactory) {
for _, p := range projects {
pods, err := resourceFactory(p, "pod", "millicore")
if err != nil {
tasks <- NewError(err)
continue
}
for _, pod := range pods {
tasks <- GetMillicoreConfig(runner, p, pod)
}
}
}
// GetMillicoreConfig will retrieve the Millicore config from the Millicore
// container inside the provided pod and project.
func GetMillicoreConfig(r Runner, project, pod string) Task {
return func() error {
cmd := exec.Command("oc", "-n", project, "exec", pod, "--", "cat", "/etc/feedhenry/cluster-override.properties")
path := filepath.Join("projects", project, "millicore", pod+"_cluster-override.properties")
return MarkErrorAsIgnorable(r.Run(cmd, path))
}
}