当前位置: 首页>>代码示例>>Golang>>正文


Golang system.System类代码示例

本文整理汇总了Golang中github.com/aelsabbahy/goss/system.System的典型用法代码示例。如果您正苦于以下问题:Golang System类的具体用法?Golang System怎么用?Golang System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了System类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Validate

func (f *File) Validate(sys *system.System) []TestResult {
	skip := false
	sysFile := sys.NewFile(f.Path, sys, util.Config{})

	var results []TestResult
	results = append(results, ValidateValue(f, "exists", f.Exists, sysFile.Exists, skip))
	if shouldSkip(results) {
		skip = true
	}
	if f.Mode != nil {
		results = append(results, ValidateValue(f, "mode", f.Mode, sysFile.Mode, skip))
	}
	if f.Owner != nil {
		results = append(results, ValidateValue(f, "owner", f.Owner, sysFile.Owner, skip))
	}
	if f.Group != nil {
		results = append(results, ValidateValue(f, "group", f.Group, sysFile.Group, skip))
	}
	if f.LinkedTo != nil {
		results = append(results, ValidateValue(f, "linkedto", f.LinkedTo, sysFile.LinkedTo, skip))
	}
	if f.Filetype != nil {
		results = append(results, ValidateValue(f, "filetype", f.Filetype, sysFile.Filetype, skip))
	}
	if len(f.Contains) > 0 {
		results = append(results, ValidateContains(f, "contains", f.Contains, sysFile.Contains, skip))
	}
	if f.Size != nil {
		results = append(results, ValidateValue(f, "size", f.Size, sysFile.Size, skip))
	}
	return results
}
开发者ID:aelsabbahy,项目名称:goss,代码行数:32,代码来源:file.go

示例2: Validate

func (f *File) Validate(sys *system.System) []TestResult {
	sysFile := sys.NewFile(f.Path, sys)

	var results []TestResult

	results = append(results, ValidateValue(f, "exists", f.Exists, sysFile.Exists))

	if f.Mode != "" {
		results = append(results, ValidateValue(f, "mode", f.Mode, sysFile.Mode))
	}

	if f.Owner != "" {
		results = append(results, ValidateValue(f, "owner", f.Owner, sysFile.Owner))
	}

	if f.Group != "" {
		results = append(results, ValidateValue(f, "group", f.Group, sysFile.Group))
	}

	if f.LinkedTo != "" {
		results = append(results, ValidateValue(f, "linkedto", f.LinkedTo, sysFile.LinkedTo))
	}

	if f.Filetype != "" {
		results = append(results, ValidateValue(f, "filetype", f.Filetype, sysFile.Filetype))
	}

	if len(f.Contains) != 0 {
		results = append(results, ValidateContains(f, "contains", f.Contains, sysFile.Contains))
	}

	return results
}
开发者ID:netluxe,项目名称:goss,代码行数:33,代码来源:file.go

示例3: Validate

func (p *Process) Validate(sys *system.System) []TestResult {
	skip := false
	sysProcess := sys.NewProcess(p.Executable, sys, util.Config{})

	var results []TestResult
	results = append(results, ValidateValue(p, "running", p.Running, sysProcess.Running, skip))
	return results
}
开发者ID:aelsabbahy,项目名称:goss,代码行数:8,代码来源:process.go

示例4: Validate

func (a *KernelParam) Validate(sys *system.System) []TestResult {
	skip := false
	sysKernelParam := sys.NewKernelParam(a.Key, sys, util.Config{})

	var results []TestResult
	results = append(results, ValidateValue(a, "value", a.Value, sysKernelParam.Value, skip))
	return results
}
开发者ID:aelsabbahy,项目名称:goss,代码行数:8,代码来源:kernel_param.go

示例5: AppendSysResourceIfExists

func (r PortMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Port, system.Port, bool) {
	sysres := sys.NewPort(sr, sys)
	res := NewPort(sysres, []string{})
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
开发者ID:netluxe,项目名称:goss,代码行数:9,代码来源:resource_list.go

示例6: AppendSysResourceIfExists

func (r ResourceTypeMap) AppendSysResourceIfExists(sr string, sys *system.System) (*ResourceType, system.ResourceType, bool) {
	sysres := sys.NewResourceType(sr, sys)
	res := NewResourceType(sysres, []string{})
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
开发者ID:netluxe,项目名称:goss,代码行数:9,代码来源:resource_list_genny.go

示例7: Validate

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
}
开发者ID:aelsabbahy,项目名称:goss,代码行数:9,代码来源:service.go

示例8: AppendSysResource

func (r GossfileMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Gossfile, error) {
	sysres := sys.NewGossfile(sr, sys, config)
	res, err := NewGossfile(sysres, config)
	if err != nil {
		return nil, err
	}
	r[res.ID()] = res
	return res, nil
}
开发者ID:ryancox,项目名称:goss,代码行数:9,代码来源:resource_list.go

示例9: Validate

func (p *Process) Validate(sys *system.System) []TestResult {
	sysProcess := sys.NewProcess(p.Executable, sys)

	var results []TestResult

	results = append(results, ValidateValue(p, "running", p.Running, sysProcess.Running))

	return results
}
开发者ID:netluxe,项目名称:goss,代码行数:9,代码来源:process.go

示例10: AppendSysResourceIfExists

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
}
开发者ID:timstoop,项目名称:goss,代码行数:9,代码来源:resource_list.go

示例11: Validate

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
}
开发者ID:postfix,项目名称:goss,代码行数:10,代码来源:service.go

示例12: Validate

func (h *Addr) Validate(sys *system.System) []TestResult {
	sysAddr := sys.NewAddr(h.Address, sys)
	sysAddr.Timeout = h.Timeout

	var results []TestResult

	results = append(results, ValidateValue(h.Address, "reachable", h.Reachable, sysAddr.Reachable))

	return results
}
开发者ID:postfix,项目名称:goss,代码行数:10,代码来源:addr.go

示例13: AppendSysResourceIfExists

func (r CommandMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Command, system.Command, bool) {
	sysres := sys.NewCommand(sr, sys, util.Config{})
	// FIXME: Do we want to be silent about errors?
	res, _ := NewCommand(sysres, util.Config{})
	if e, _ := sysres.Exists(); e != true {
		return res, sysres, false
	}
	r[res.ID()] = res
	return res, sysres, true
}
开发者ID:ryancox,项目名称:goss,代码行数:10,代码来源:resource_list.go

示例14: Validate

func (a *Addr) Validate(sys *system.System) []TestResult {
	skip := false
	if a.Timeout == 0 {
		a.Timeout = 500
	}
	sysAddr := sys.NewAddr(a.Address, sys, util.Config{Timeout: a.Timeout})

	var results []TestResult
	results = append(results, ValidateValue(a, "reachable", a.Reachable, sysAddr.Reachable, skip))
	return results
}
开发者ID:aelsabbahy,项目名称:goss,代码行数:11,代码来源:addr.go

示例15: Validate

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
}
开发者ID:ryancox,项目名称:goss,代码行数:13,代码来源:package.go


注:本文中的github.com/aelsabbahy/goss/system.System类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。