Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(388)

Unified Diff: state/apiserver/uniter/uniter.go

Issue 13490043: various: Relation tags use keys, not ids (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « names/tag_test.go ('k') | state/apiserver/uniter/uniter_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: state/apiserver/uniter/uniter.go
=== modified file 'state/apiserver/uniter/uniter.go'
--- state/apiserver/uniter/uniter.go 2013-09-02 15:56:26 +0000
+++ state/apiserver/uniter/uniter.go 2013-09-03 11:49:29 +0000
@@ -7,7 +7,6 @@
import (
"fmt"
- "strconv"
"launchpad.net/juju-core/charm"
"launchpad.net/juju-core/errors"
@@ -613,18 +612,11 @@
}
func (u *UniterAPI) getRelationAndUnit(canAccess common.AuthFunc, relTag, unitTag string) (*state.Relation, *state.Unit, error) {
- _, id, err := names.ParseTag(relTag, names.RelationTagKind)
- if err != nil {
- return nil, nil, common.ErrPerm
- }
- // TODO(dimitern): Once the relation tags have a different format
- // (e.g. "relation-service1@name1+service2@name2"), change the
- // following code accordingly.
- relId, err := strconv.Atoi(id)
- if err != nil {
- return nil, nil, common.ErrPerm
- }
- rel, err := u.st.Relation(relId)
+ _, key, err := names.ParseTag(relTag, names.RelationTagKind)
+ if err != nil {
+ return nil, nil, common.ErrPerm
+ }
+ rel, err := u.st.KeyRelation(key)
if errors.IsNotFoundError(err) {
return nil, nil, common.ErrPerm
} else if err != nil {
« no previous file with comments | « names/tag_test.go ('k') | state/apiserver/uniter/uniter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b