~ubuntu-branches/ubuntu/trusty/juju-core/trusty

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/state/life.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-03-24 16:05:44 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20140324160544-g8lsfufby18d5fj4
Tags: 1.17.6-0ubuntu1
* New upstream point release, including fixes for:
  - br0 not bought up by cloud-init with MAAS provider (LP: #1271144).
  - ppc64el enablement for juju/lxc (LP: #1273769).
  - juju userdata should not restart networking (LP: #1248283).
  - error detecting hardware characteristics (LP: #1276909).
  - juju instances not including the default security group (LP: #1129720).
  - juju bootstrap does not honor https_proxy (LP: #1240260).
* d/control,rules: Drop BD on bash-completion, install bash-completion
  direct from upstream source code.
* d/rules: Set HOME prior to generating man pages.
* d/control: Drop alternative dependency on mongodb-server; juju now only
  works on trusty with juju-mongodb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
import (
7
7
        "labix.org/v2/mgo"
 
8
        "labix.org/v2/mgo/bson"
8
9
 
9
10
        "launchpad.net/juju-core/state/api/params"
10
11
)
30
31
        return string(lifeStrings[l])
31
32
}
32
33
 
33
 
var isAliveDoc = D{{"life", Alive}}
34
 
var isDeadDoc = D{{"life", Dead}}
35
 
var notDeadDoc = D{{"life", D{{"$ne", Dead}}}}
 
34
var isAliveDoc = bson.D{{"life", Alive}}
 
35
var isDeadDoc = bson.D{{"life", Dead}}
 
36
var notDeadDoc = bson.D{{"life", bson.D{{"$ne", Dead}}}}
36
37
 
37
38
// Living describes state entities with a lifecycle.
38
39
type Living interface {
50
51
}
51
52
 
52
53
func isAlive(coll *mgo.Collection, id interface{}) (bool, error) {
53
 
        n, err := coll.Find(D{{"_id", id}, {"life", Alive}}).Count()
 
54
        n, err := coll.Find(bson.D{{"_id", id}, {"life", Alive}}).Count()
54
55
        return n == 1, err
55
56
}
56
57
 
57
58
func isNotDead(coll *mgo.Collection, id interface{}) (bool, error) {
58
 
        n, err := coll.Find(D{{"_id", id}, {"life", D{{"$ne", Dead}}}}).Count()
 
59
        n, err := coll.Find(bson.D{{"_id", id}, {"life", bson.D{{"$ne", Dead}}}}).Count()
59
60
        return n == 1, err
60
61
}