Exemple #1
0
// Service returns the service.
func (u *Unit) Service() (*Service, error) {
	serviceTag := names.ServiceTag(u.ServiceName())
	service := &Service{
		st:  u.st,
		tag: serviceTag,
	}
	// Call Refresh() immediately to get the up-to-date
	// life and other needed locally cached fields.
	err := service.Refresh()
	if err != nil {
		return nil, err
	}
	return service, nil
}
Exemple #2
0
// Tag returns a name identifying the service that is safe to use
// as a file name.  The returned name will be different from other
// Tag values returned by any other entities from the same state.
func (s *Service) Tag() string {
	return names.ServiceTag(s.Name())
}
Exemple #3
0
// ServiceTag returns the service tag.
func (u *Unit) ServiceTag() string {
	return names.ServiceTag(u.ServiceName())
}