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

Side by Side Diff: state/unit.go

Issue 8821043: state: lose misleading log messages
Patch Set: state: lose misleading log messages Created 10 years, 11 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « state/megawatcher.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package state 1 package state
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 "fmt" 5 "fmt"
6 "labix.org/v2/mgo" 6 "labix.org/v2/mgo"
7 "labix.org/v2/mgo/txn" 7 "labix.org/v2/mgo/txn"
8 "launchpad.net/juju-core/charm" 8 "launchpad.net/juju-core/charm"
9 "launchpad.net/juju-core/state/api/params" 9 "launchpad.net/juju-core/state/api/params"
10 "launchpad.net/juju-core/state/presence" 10 "launchpad.net/juju-core/state/presence"
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 func (u *Unit) AssignedMachineId() (id string, err error) { 661 func (u *Unit) AssignedMachineId() (id string, err error) {
662 if u.IsPrincipal() { 662 if u.IsPrincipal() {
663 if u.doc.MachineId == "" { 663 if u.doc.MachineId == "" {
664 return "", &NotAssignedError{u} 664 return "", &NotAssignedError{u}
665 } 665 }
666 return u.doc.MachineId, nil 666 return u.doc.MachineId, nil
667 } 667 }
668 pudoc := unitDoc{} 668 pudoc := unitDoc{}
669 err = u.st.units.Find(D{{"_id", u.doc.Principal}}).One(&pudoc) 669 err = u.st.units.Find(D{{"_id", u.doc.Principal}}).One(&pudoc)
670 if err == mgo.ErrNotFound { 670 if err == mgo.ErrNotFound {
671 » » return "", NotFoundf("principal unit %q", u, u.doc.Principal) 671 » » return "", NotFoundf("principal unit %q of %q", u.doc.Principal, u)
672 } else if err != nil { 672 } else if err != nil {
673 return "", err 673 return "", err
674 } 674 }
675 if pudoc.MachineId == "" { 675 if pudoc.MachineId == "" {
676 return "", &NotAssignedError{u} 676 return "", &NotAssignedError{u}
677 } 677 }
678 return pudoc.MachineId, nil 678 return pudoc.MachineId, nil
679 } 679 }
680 680
681 var ( 681 var (
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 return p1.Protocol < p2.Protocol 1014 return p1.Protocol < p2.Protocol
1015 } 1015 }
1016 return p1.Number < p2.Number 1016 return p1.Number < p2.Number
1017 } 1017 }
1018 1018
1019 // SortPorts sorts the given ports, first by protocol, 1019 // SortPorts sorts the given ports, first by protocol,
1020 // then by number. 1020 // then by number.
1021 func SortPorts(ports []params.Port) { 1021 func SortPorts(ports []params.Port) {
1022 sort.Sort(portSlice(ports)) 1022 sort.Sort(portSlice(ports))
1023 } 1023 }
OLDNEW
« no previous file with comments | « state/megawatcher.go ('k') | no next file » | no next file with comments »

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