本文整理汇总了Golang中github.com/aelsabbahy/goss/system.System类的典型用法代码示例。如果您正苦于以下问题:Golang System类的具体用法?Golang System怎么用?Golang System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了System类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Validate
func (f *File) Validate(sys *system.System) []TestResult {
skip := false
sysFile := sys.NewFile(f.Path, sys, util.Config{})
var results []TestResult
results = append(results, ValidateValue(f, "exists", f.Exists, sysFile.Exists, skip))
if shouldSkip(results) {
skip = true
}
if f.Mode != nil {
results = append(results, ValidateValue(f, "mode", f.Mode, sysFile.Mode, skip))
}
if f.Owner != nil {
results = append(results, ValidateValue(f, "owner", f.Owner, sysFile.Owner, skip))
}
if f.Group != nil {
results = append(results, ValidateValue(f, "group", f.Group, sysFile.Group, skip))
}
if f.LinkedTo != nil {
results = append(results, ValidateValue(f, "linkedto", f.LinkedTo, sysFile.LinkedTo, skip))
}
if f.Filetype != nil {
results = append(results, ValidateValue(f, "filetype", f.Filetype, sysFile.Filetype, skip))
}
if len(f.Contains) > 0 {
results = append(results, ValidateContains(f, "contains", f.Contains, sysFile.Contains, skip))
}
if f.Size != nil {
results = append(results, ValidateValue(f, "size", f.Size, sysFile.Size, skip))
}
return results
}
示例2: Validate
func (f *File) Validate(sys *system.System) []TestResult {
sysFile := sys.NewFile(f.Path, sys)
var results []TestResult
results = append(results, ValidateValue(f, "exists", f.Exists, sysFile.Exists))
if f.Mode != "" {
results = append(results, ValidateValue(f, "mode", f.Mode, sysFile.Mode))
}
if f.Owner != "" {
results = append(results, ValidateValue(f, "owner", f.Owner, sysFile.Owner))
}
if f.Group != "" {
results = append(results, ValidateValue(f, "group", f.Group, sysFile.Group))
}
if f.LinkedTo != "" {
results = append(results, ValidateValue(f, "linkedto", f.LinkedTo, sysFile.LinkedTo))
}
if f.Filetype != "" {
results = append(results, ValidateValue(f, "filetype", f.Filetype, sysFile.Filetype))
}
if len(f.Contains) != 0 {
results = append(results, ValidateContains(f, "contains", f.Contains, sysFile.Contains))
}
return results
}
示例3: Validate
func (p *Process) Validate(sys *system.System) []TestResult {
skip := false
sysProcess := sys.NewProcess(p.Executable, sys, util.Config{})
var results []TestResult
results = append(results, ValidateValue(p, "running", p.Running, sysProcess.Running, skip))
return results
}
示例4: Validate
func (a *KernelParam) Validate(sys *system.System) []TestResult {
skip := false
sysKernelParam := sys.NewKernelParam(a.Key, sys, util.Config{})
var results []TestResult
results = append(results, ValidateValue(a, "value", a.Value, sysKernelParam.Value, skip))
return results
}
示例5: AppendSysResourceIfExists
func (r PortMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Port, system.Port, bool) {
sysres := sys.NewPort(sr, sys)
res := NewPort(sysres, []string{})
if e, _ := sysres.Exists(); e != true {
return res, sysres, false
}
r[res.ID()] = res
return res, sysres, true
}
示例6: AppendSysResourceIfExists
func (r ResourceTypeMap) AppendSysResourceIfExists(sr string, sys *system.System) (*ResourceType, system.ResourceType, bool) {
sysres := sys.NewResourceType(sr, sys)
res := NewResourceType(sysres, []string{})
if e, _ := sysres.Exists(); e != true {
return res, sysres, false
}
r[res.ID()] = res
return res, sysres, true
}
示例7: Validate
func (s *Service) Validate(sys *system.System) []TestResult {
skip := false
sysservice := sys.NewService(s.Service, sys, util.Config{})
var results []TestResult
results = append(results, ValidateValue(s, "enabled", s.Enabled, sysservice.Enabled, skip))
results = append(results, ValidateValue(s, "running", s.Running, sysservice.Running, skip))
return results
}
示例8: AppendSysResource
func (r GossfileMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Gossfile, error) {
sysres := sys.NewGossfile(sr, sys, config)
res, err := NewGossfile(sysres, config)
if err != nil {
return nil, err
}
r[res.ID()] = res
return res, nil
}
示例9: Validate
func (p *Process) Validate(sys *system.System) []TestResult {
sysProcess := sys.NewProcess(p.Executable, sys)
var results []TestResult
results = append(results, ValidateValue(p, "running", p.Running, sysProcess.Running))
return results
}
示例10: AppendSysResourceIfExists
func (r DNSMap) AppendSysResourceIfExists(sr string, sys *system.System) (*DNS, system.DNS, bool) {
sysres := sys.NewDNS(sr, sys)
res := NewDNS(sysres)
if e, _ := sysres.Exists(); e != true {
return res, sysres, false
}
r[res.ID()] = res
return res, sysres, true
}
示例11: Validate
func (s *Service) Validate(sys *system.System) []TestResult {
sysservice := sys.NewService(s.Service, sys)
var results []TestResult
results = append(results, ValidateValue(s.Service, "enabled", s.Enabled, sysservice.Enabled))
results = append(results, ValidateValue(s.Service, "running", s.Running, sysservice.Running))
return results
}
示例12: Validate
func (h *Addr) Validate(sys *system.System) []TestResult {
sysAddr := sys.NewAddr(h.Address, sys)
sysAddr.Timeout = h.Timeout
var results []TestResult
results = append(results, ValidateValue(h.Address, "reachable", h.Reachable, sysAddr.Reachable))
return results
}
示例13: AppendSysResourceIfExists
func (r CommandMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Command, system.Command, bool) {
sysres := sys.NewCommand(sr, sys, util.Config{})
// FIXME: Do we want to be silent about errors?
res, _ := NewCommand(sysres, util.Config{})
if e, _ := sysres.Exists(); e != true {
return res, sysres, false
}
r[res.ID()] = res
return res, sysres, true
}
示例14: Validate
func (a *Addr) Validate(sys *system.System) []TestResult {
skip := false
if a.Timeout == 0 {
a.Timeout = 500
}
sysAddr := sys.NewAddr(a.Address, sys, util.Config{Timeout: a.Timeout})
var results []TestResult
results = append(results, ValidateValue(a, "reachable", a.Reachable, sysAddr.Reachable, skip))
return results
}
示例15: Validate
func (p *Package) Validate(sys *system.System) []TestResult {
sysPkg := sys.NewPackage(p.Name, sys, util.Config{})
var results []TestResult
results = append(results, ValidateValue(p, "installed", p.Installed, sysPkg.Installed))
if len(p.Versions) > 0 {
results = append(results, ValidateValues(p, "version", p.Versions, sysPkg.Versions))
}
return results
}