示例#1
0
func (r AddrMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Addr, error) {
	sysres := sys.NewAddr(sr, sys, config)
	res, err := NewAddr(sysres, config)
	if err != nil {
		return nil, err
	}
	r[res.ID()] = res
	return res, nil
}
示例#2
0
func (r AddrMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Addr, system.Addr, bool) {
	sysres := sys.NewAddr(sr, sys)
	res := NewAddr(sysres)
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
示例#3
0
func (r AddrMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Addr, system.Addr, bool) {
	sysres := sys.NewAddr(sr, sys, util.Config{})
	// FIXME: Do we want to be silent about errors?
	res, _ := NewAddr(sysres, util.Config{})
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
示例#4
0
文件: addr.go 项目: postfix/goss
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
}
示例#5
0
文件: addr.go 项目: aelsabbahy/goss
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
}
示例#6
0
func (r AddrMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Addr, error) {
	sysres := sys.NewAddr(sr, sys, config)
	res, err := NewAddr(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
}
示例#7
0
func (r AddrMap) AppendSysResource(sr string, sys *system.System) (*Addr, system.Addr) {
	sysres := sys.NewAddr(sr, sys)
	res := NewAddr(sysres)
	r[res.ID()] = res
	return res, sysres
}