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

	var results []TestResult

	results = append(results, ValidateValue(g, "exists", g.Exists, sysgroup.Exists))

	if g.Gid != "" {
		results = append(results, ValidateValue(g, "gid", g.Gid, sysgroup.Gid))
	}

	return results
}
示例#6
0
文件: group.go 项目: postfix/goss
func (s *Group) Validate(sys *system.System) []TestResult {
	sysgroup := sys.NewGroup(s.Groupname, sys)

	var results []TestResult

	results = append(results, ValidateValue(s.Groupname, "exists", s.Exists, sysgroup.Exists))
	if !s.Exists {
		return results
	}
	results = append(results, ValidateValue(s.Gid, "gid", s.Gid, sysgroup.Gid))

	return results
}
示例#7
0
文件: group.go 项目: aelsabbahy/goss
func (g *Group) Validate(sys *system.System) []TestResult {
	skip := false
	sysgroup := sys.NewGroup(g.Groupname, sys, util.Config{})

	var results []TestResult
	results = append(results, ValidateValue(g, "exists", g.Exists, sysgroup.Exists, skip))
	if shouldSkip(results) {
		skip = true
	}
	if g.GID != nil {
		gGID := deprecateAtoI(g.GID, fmt.Sprintf("%s: group.gid", g.Groupname))
		results = append(results, ValidateValue(g, "gid", gGID, sysgroup.GID, skip))
	}
	return results
}
示例#8
0
func (r GroupMap) AppendSysResource(sr string, sys *system.System) (*Group, system.Group) {
	sysres := sys.NewGroup(sr, sys)
	res := NewGroup(sysres)
	r[res.ID()] = res
	return res, sysres
}