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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
func (r CommandMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Command, error) { sysres := sys.NewCommand(sr, sys, config) res, err := NewCommand(sysres, config) if err != nil { return nil, err } r[res.ID()] = res return res, nil }
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 }
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 }
func (r CommandMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Command, system.Command, bool) { sysres := sys.NewCommand(sr, sys) res := NewCommand(sysres) if e, _ := sysres.Exists(); e != true { return res, sysres, false } r[res.ID()] = res return res, sysres, true }
func (r ServiceMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Service, system.Service, bool) { sysres := sys.NewService(sr, sys) res := NewService(sysres) if e, _ := sysres.Exists(); e != true { return res, sysres, false } r[res.ID()] = res return res, sysres, true }
func (r ProcessMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Process, system.Process, bool) { sysres := sys.NewProcess(sr, sys) res := NewProcess(sysres) if e, _ := sysres.Exists(); e != true { return res, sysres, false } r[res.ID()] = res return res, sysres, true }
func (r GroupMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Group, system.Group, bool) { sysres := sys.NewGroup(sr, sys) res := NewGroup(sysres) if e, _ := sysres.Exists(); e != true { return res, sysres, false } r[res.ID()] = res return res, sysres, true }
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 }
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 }
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 }
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 }
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 }
func (g *Group) Validate(sys *system.System) []TestResult { sysgroup := sys.NewGroup(g.Groupname, sys) var results []TestResult results = append(results, ValidateValue(g, "exists", g.Exists, sysgroup.Exists)) if g.Gid != "" { results = append(results, ValidateValue(g, "gid", g.Gid, sysgroup.Gid)) } return results }
func (p *Port) Validate(sys *system.System) []TestResult { sysPort := sys.NewPort(p.Port, sys, util.Config{}) var results []TestResult results = append(results, ValidateValue(p, "listening", p.Listening, sysPort.Listening)) if len(p.IP) > 0 { results = append(results, ValidateValues(p, "ip", p.IP, sysPort.IP)) } return results }
func (p *Port) Validate(sys *system.System) []TestResult { sysPort := sys.NewPort(p.Port, sys) var results []TestResult results = append(results, ValidateValue(p.Port, "listening", p.Listening, sysPort.Listening)) if !p.Listening { return results } results = append(results, ValidateValue(p.Port, "ip", p.IP, sysPort.IP)) return results }
func (s *Group) Validate(sys *system.System) []TestResult { sysgroup := sys.NewGroup(s.Groupname, sys) var results []TestResult results = append(results, ValidateValue(s.Groupname, "exists", s.Exists, sysgroup.Exists)) if !s.Exists { return results } results = append(results, ValidateValue(s.Gid, "gid", s.Gid, sysgroup.Gid)) return results }
func (r ProcessMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Process, error) { sysres := sys.NewProcess(sr, sys, config) res, err := NewProcess(sysres, config) if err != nil { return nil, err } if old_res, ok := r[res.ID()]; ok { res.Title = old_res.Title res.Meta = old_res.Meta } r[res.ID()] = res return res, nil }
func (p *Package) Validate(sys *system.System) []TestResult { sysPkg := sys.NewPackage(p.Name, sys) var results []TestResult results = append(results, ValidateValue(p.Name, "installed", p.Installed, sysPkg.Installed)) if !p.Installed { return results } results = append(results, ValidateValues(p.Name, "version", p.Versions, sysPkg.Versions)) return results }
func (r ProcessMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Process, system.Process, bool) { sysres := sys.NewProcess(sr, sys, util.Config{}) // FIXME: Do we want to be silent about errors? res, _ := NewProcess(sysres, util.Config{}) if e, _ := sysres.Exists(); e != true { return res, sysres, false } if old_res, ok := r[res.ID()]; ok { res.Title = old_res.Title res.Meta = old_res.Meta } r[res.ID()] = res return res, sysres, true }
func (d *DNS) Validate(sys *system.System) []TestResult { sysDNS := sys.NewDNS(d.Host, sys) sysDNS.Timeout = d.Timeout var results []TestResult results = append(results, ValidateValue(d.Host, "resolveable", d.Resolveable, sysDNS.Resolveable)) if !d.Resolveable { return results } results = append(results, ValidateValues(d.Host, "addrs", d.Addrs, sysDNS.Addrs)) return results }
func (p *Package) Validate(sys *system.System) []TestResult { skip := false sysPkg := sys.NewPackage(p.Name, sys, util.Config{}) var results []TestResult results = append(results, ValidateValue(p, "installed", p.Installed, sysPkg.Installed, skip)) if shouldSkip(results) { skip = true } if p.Versions != nil { results = append(results, ValidateValue(p, "version", p.Versions, sysPkg.Versions, skip)) } return results }
func (p *Port) Validate(sys *system.System) []TestResult { skip := false sysPort := sys.NewPort(p.Port, sys, util.Config{}) var results []TestResult results = append(results, ValidateValue(p, "listening", p.Listening, sysPort.Listening, skip)) if shouldSkip(results) { skip = true } if p.IP != nil { results = append(results, ValidateValue(p, "ip", p.IP, sysPort.IP, skip)) } return results }