Exemple #1
0
func (r DNSMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*DNS, error) {
	sysres := sys.NewDNS(sr, sys, config)
	res, err := NewDNS(sysres, config)
	if err != nil {
		return nil, err
	}
	r[res.ID()] = res
	return res, nil
}
Exemple #2
0
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
}
Exemple #3
0
func (r DNSMap) AppendSysResourceIfExists(sr string, sys *system.System) (*DNS, system.DNS, bool) {
	sysres := sys.NewDNS(sr, sys, util.Config{})
	// FIXME: Do we want to be silent about errors?
	res, _ := NewDNS(sysres, util.Config{})
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
Exemple #4
0
func (r DNSMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*DNS, error) {
	sysres := sys.NewDNS(sr, sys, config)
	res, err := NewDNS(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
}
Exemple #5
0
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
}
Exemple #6
0
func (d *DNS) Validate(sys *system.System) []TestResult {
	if d.Timeout == 0 {
		d.Timeout = 500
	}
	sysDNS := sys.NewDNS(d.Host, sys, util.Config{Timeout: d.Timeout})

	var results []TestResult

	results = append(results, ValidateValue(d, "resolveable", d.Resolveable, sysDNS.Resolveable))

	if len(d.Addrs) > 0 {
		results = append(results, ValidateValues(d, "addrs", d.Addrs, sysDNS.Addrs))
	}

	return results
}
Exemple #7
0
func (d *DNS) Validate(sys *system.System) []TestResult {
	skip := false
	if d.Timeout == 0 {
		d.Timeout = 500
	}
	sysDNS := sys.NewDNS(d.Host, sys, util.Config{Timeout: d.Timeout})

	var results []TestResult
	results = append(results, ValidateValue(d, "resolveable", d.Resolveable, sysDNS.Resolveable, skip))
	if shouldSkip(results) {
		skip = true
	}
	if d.Addrs != nil {
		results = append(results, ValidateValue(d, "addrs", d.Addrs, sysDNS.Addrs, skip))
	}
	return results
}
Exemple #8
0
func (r DNSMap) AppendSysResource(sr string, sys *system.System) (*DNS, system.DNS) {
	sysres := sys.NewDNS(sr, sys)
	res := NewDNS(sysres)
	r[res.ID()] = res
	return res, sysres
}