本文整理汇总了Golang中github.com/aelsabbahy/goss/system.System.NewService方法的典型用法代码示例。如果您正苦于以下问题:Golang System.NewService方法的具体用法?Golang System.NewService怎么用?Golang System.NewService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aelsabbahy/goss/system.System
的用法示例。
在下文中一共展示了System.NewService方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AppendSysResource
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
}
示例2: AppendSysResourceIfExists
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
}
示例3: 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
}
示例4: AppendSysResourceIfExists
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
}
示例5: 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
}
示例6: AppendSysResource
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
}
示例7: AppendSysResource
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
}