launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15044
[Merge] lp:~jtv/juju-core/add-maas-client into lp:~maas-maintainers/juju-core/maas-provider-skeleton
Jeroen T. Vermeulen has proposed merging lp:~jtv/juju-core/add-maas-client into lp:~maas-maintainers/juju-core/maas-provider-skeleton.
Commit message:
Keep a gomaasapi.Client in the MAAS EnvironProvider, so that it'll be able to access the MAAS API.
Requested reviews:
MAAS Maintainers (maas-maintainers)
For more details, see:
https://code.launchpad.net/~jtv/juju-core/add-maas-client/+merge/145346
We're still figuring out what it takes to implement a provider in juju-core, so baby steps.
This is for merging into our feature branch. We can go for a landing in juju-core once we have something minimally functional.
Jeroen
--
https://code.launchpad.net/~jtv/juju-core/add-maas-client/+merge/145346
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/juju-core/add-maas-client into lp:~maas-maintainers/juju-core/maas-provider-skeleton.
=== modified file 'environs/maas/environ.go'
--- environs/maas/environ.go 2013-01-29 09:51:16 +0000
+++ environs/maas/environ.go 2013-01-29 11:24:21 +0000
@@ -2,6 +2,7 @@
import (
"errors"
+ "launchpad.net/gomaasapi"
"launchpad.net/juju-core/environs"
"launchpad.net/juju-core/environs/config"
"launchpad.net/juju-core/log"
@@ -10,18 +11,20 @@
)
type maasEnviron struct {
- name string
+ name string
+ maasClient *gomaasapi.Client
}
var _ environs.Environ = (*maasEnviron)(nil)
var couldNotAllocate = errors.New("Could not allocate MAAS environment object.")
-func NewEnviron(cfg *config.Config) (*maasEnviron, error) {
+func NewEnviron(cfg *config.Config, maasClient *gomaasapi.Client) (*maasEnviron, error) {
env := new(maasEnviron)
if env == nil {
return nil, couldNotAllocate
}
+ env.maasClient = maasClient
err := env.SetConfig(cfg)
if err != nil {
return nil, err
=== modified file 'environs/maas/environprovider.go'
--- environs/maas/environprovider.go 2013-01-29 09:51:16 +0000
+++ environs/maas/environprovider.go 2013-01-29 11:24:21 +0000
@@ -1,18 +1,21 @@
package maas
import (
+ "launchpad.net/gomaasapi"
"launchpad.net/juju-core/environs"
"launchpad.net/juju-core/environs/config"
"launchpad.net/juju-core/log"
)
-type maasEnvironProvider struct{}
+type maasEnvironProvider struct {
+ maasClient *gomaasapi.Client
+}
var _ environs.EnvironProvider = (*maasEnvironProvider)(nil)
-func (*maasEnvironProvider) Open(cfg *config.Config) (environs.Environ, error) {
+func (prov *maasEnvironProvider) Open(cfg *config.Config) (environs.Environ, error) {
log.Printf("environs/maas: opening environment %q.", cfg.Name())
- return NewEnviron(cfg)
+ return NewEnviron(cfg, prov.maasClient)
}
func (*maasEnvironProvider) Validate(cfg, old *config.Config) (*config.Config, error) {