forked from cloudfoundry-attic/bosh-ext-cli
/
missing_jobs.go
38 lines (30 loc) · 880 Bytes
/
missing_jobs.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
34
35
36
37
38
package release
import (
boshrel "github.com/cloudfoundry/bosh-cli/release"
check "github.com/bosh-tools/bosh-ext-cli/lint/check"
)
type MissingJobs struct {
context check.Context
release boshrel.Release
check.Config
}
func NewMissingJobs(context check.Context, release boshrel.Release, config check.Config) MissingJobs {
return MissingJobs{context, release, config}
}
func (c MissingJobs) Description() check.Description {
return check.Description{
Context_: c.context,
Purpose_: "if at least one job is present",
}
}
func (c MissingJobs) Check() ([]check.Suggestion, error) {
var sugs []check.Suggestion
if len(c.release.Jobs()) == 0 && len(c.release.Packages()) > 0 {
sugs = append(sugs, check.Simple{
Context_: c.context,
Problem_: "Zero jobs",
Resolution_: "Add at least one job which references a package",
})
}
return sugs, nil
}