Example #1
0
func (r PortMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Port, error) {
	sysres := sys.NewPort(sr, sys, config)
	res, err := NewPort(sysres, config)
	if err != nil {
		return nil, err
	}
	r[res.ID()] = res
	return res, nil
}
Example #2
0
func (r PortMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Port, system.Port, bool) {
	sysres := sys.NewPort(sr, sys)
	res := NewPort(sysres)
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
Example #3
0
func (r PortMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Port, system.Port, bool) {
	sysres := sys.NewPort(sr, sys, util.Config{})
	// FIXME: Do we want to be silent about errors?
	res, _ := NewPort(sysres, util.Config{})
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
Example #4
0
func (r PortMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Port, error) {
	sysres := sys.NewPort(sr, sys, config)
	res, err := NewPort(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
}
Example #5
0
File: port.go Project: ryancox/goss
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
}
Example #6
0
File: port.go Project: postfix/goss
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
}
Example #7
0
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
}
Example #8
0
func (r PortMap) AppendSysResource(sr string, sys *system.System) (*Port, system.Port) {
	sysres := sys.NewPort(sr, sys)
	res := NewPort(sysres)
	r[res.ID()] = res
	return res, sysres
}