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