12
12
"github.com/juju/juju/environs/config"
15
// Register the Azure provider with Juju.
17
environs.RegisterProvider("azure", azureEnvironProvider{})
20
15
// Logger for the Azure provider.
21
16
var logger = loggo.GetLogger("juju.provider.azure")
39
34
return environ, nil
42
// Prepare is specified in the EnvironProvider interface.
43
func (prov azureEnvironProvider) Prepare(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
37
// RestrictedConfigAttributes is specified in the EnvironProvider interface.
38
func (prov azureEnvironProvider) RestrictedConfigAttributes() []string {
39
return []string{"location"}
42
// PrepareForCreateEnvironment is specified in the EnvironProvider interface.
43
func (p azureEnvironProvider) PrepareForCreateEnvironment(cfg *config.Config) (*config.Config, error) {
44
44
// Set availability-sets-enabled to true
45
45
// by default, unless the user set a value.
46
46
if _, ok := cfg.AllAttrs()["availability-sets-enabled"]; !ok {
48
48
cfg, err = cfg.Apply(map[string]interface{}{"availability-sets-enabled": true})
50
return nil, errors.Trace(err)
56
// PrepareForBootstrap is specified in the EnvironProvider interface.
57
func (prov azureEnvironProvider) PrepareForBootstrap(ctx environs.BootstrapContext, cfg *config.Config) (environs.Environ, error) {
58
cfg, err := prov.PrepareForCreateEnvironment(cfg)
60
return nil, errors.Trace(err)
53
62
env, err := prov.Open(cfg)
64
return nil, errors.Trace(err)
57
66
if ctx.ShouldVerifyCredentials() {
58
67
if err := verifyCredentials(env.(*azureEnviron)); err != nil {
68
return nil, errors.Trace(err)