Exemplo n.º 1
0
func setQueue() {
	var err error
	qfactory, err = queue.Factory()
	if err != nil {
		log.Fatalf("Failed to get the queue instance: %s", err)
	}
	_handler, err = qfactory.Handler(handle, queueName)
	if err != nil {
		log.Fatalf("Failed to create the queue handler: %s", err)
	}
}
Exemplo n.º 2
0
func (p *JujuProvisioner) unitsCollection() *db.Collection {
	name, err := config.GetString("juju:units-collection")
	if err != nil {
		log.Fatalf("FATAL: %s.", err)
	}
	conn, err := db.Conn()
	if err != nil {
		log.Fatalf("Failed to connect to the database: %s", err)
	}
	return conn.Collection(name)
}
Exemplo n.º 3
0
func (p *JujuProvisioner) bootstrapCollection() (*db.Storage, *mgo.Collection) {
	name, err := config.GetString("juju:bootstrap-collection")
	if err != nil {
		log.Fatalf("FATAL: %s.", err)
	}
	conn, err := db.Conn()
	if err != nil {
		log.Fatalf("Failed to connect to the database: %s", err)
	}
	return conn, conn.Collection(name)
}
Exemplo n.º 4
0
func getQueue(name string) queue.Q {
	o.Do(setQueue)
	q, err := qfactory.Get(name)
	if err != nil {
		log.Fatalf("Failed to get queue %q: %s", name, err)
	}
	return q
}
Exemplo n.º 5
0
func (p *LocalProvisioner) collection() *mgo.Collection {
	name, err := config.GetString("local:collection")
	if err != nil {
		log.Fatalf("FATAL: %s.", err)
	}
	conn, err := db.Conn()
	if err != nil {
		log.Printf("Failed to connect to the database: %s", err)
	}
	return conn.Collection(name)
}
Exemplo n.º 6
0
func (m *ELBManager) collection() (*db.Storage, *mgo.Collection) {
	name, err := config.GetString("juju:elb-collection")
	if err != nil {
		log.Fatal("juju:elb-collection is undefined on config file.")
	}
	conn, err := db.Conn()
	if err != nil {
		log.Fatalf("[juju] Failed to connect to the database: %s", err)
	}
	return conn, conn.Collection(name)
}
Exemplo n.º 7
0
// Provision creates a route for the container
func (p *dockerProvisioner) Provision(app provision.App) error {
	r, err := getRouter()
	if err != nil {
		log.Fatalf("Failed to get router: %s", err)
		return err
	}
	err = app.Ready()
	if err != nil {
		return err
	}
	return r.AddBackend(app.GetName())
}