~themue/juju-core/053-env-more-script-friendly

« back to all changes in this revision

Viewing changes to state/service.go

  • Committer: Dimiter Naydenov
  • Date: 2013-07-29 15:15:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1565.
  • Revision ID: dimiter.naydenov@canonical.com-20130729151541-zm8murwo9u7mtsdu
names: new package

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        "launchpad.net/juju-core/charm"
17
17
        "launchpad.net/juju-core/constraints"
18
18
        "launchpad.net/juju-core/errors"
 
19
        "launchpad.net/juju-core/names"
19
20
        "launchpad.net/juju-core/state/api/params"
20
21
        "launchpad.net/juju-core/utils"
21
22
)
66
67
// as a file name.  The returned name will be different from other
67
68
// Tag values returned by any other entities from the same state.
68
69
func (s *Service) Tag() string {
69
 
        return "service-" + s.Name()
 
70
        return names.ServiceTag(s.Name())
70
71
}
71
72
 
72
73
// serviceGlobalKey returns the global database key for the service
691
692
 
692
693
// Unit returns the service's unit with name.
693
694
func (s *Service) Unit(name string) (*Unit, error) {
694
 
        if !IsUnitName(name) {
 
695
        if !names.IsUnitName(name) {
695
696
                return nil, fmt.Errorf("%q is not a valid unit name", name)
696
697
        }
697
698
        udoc := &unitDoc{}