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