Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take account of provider specific config when creating models and bootstrapping #6079

Merged
merged 1 commit into from Aug 24, 2016

Conversation

wallyworld
Copy link
Member

@wallyworld wallyworld commented Aug 24, 2016

Fixes: https://bugs.launchpad.net/juju-core/+bug/1615552

Providers can define their own bespoke config in the environprovider. This is separate to the generic environs/config applicable to all providers. We need to account for this config when bootstrapping (apply the config to the model) and also when figuring out model config source ("default", "controller" etc).

Add code to bootstrap and also model config handling in state. A new state policy method is required to allow state to access the provider.

QA
Hack LXD provider to have config that doesn't do anything.
Bootstrap LXD, using --config to set one of the hacked values
$ juju model-config
$ juju model-defaults show the expected values

$ juju set-model-config foo=bar
(where foo is one of the provider attrs, no warning printed like we used to see)

$ juju model-config
shows the correct values

$ juju unset-model-config foo
resets the value to the provider value

@@ -372,14 +373,15 @@ func (c *bootstrapCommand) Run(ctx *cmd.Context) (resultErr error) {
return errors.Trace(err)
}

provider, err := environs.Provider(cloud.Type)
if err != nil {
logger.Infof(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@wallyworld wallyworld force-pushed the provider-default-config branch 2 times, most recently from c33dc2a to 0d95cef Compare August 24, 2016 08:39
return nil, errors.Trace(err)
}
fields := schema.FieldMap(providerDefaults.ProviderConfig(), providerDefaults.ProviderConfigDefaults())
if coercedAtts, err := fields.Coerce(defaults, nil); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Atts/Attrs/ ?

@axw
Copy link
Contributor

axw commented Aug 24, 2016

Please add TODO(wallyworld) to have environs.EnvironProvider embed config.ConfigSource (sic), making it required, and drop the interface assertions.

@axw
Copy link
Contributor

axw commented Aug 24, 2016

LGTM with a few niggles

@wallyworld wallyworld force-pushed the provider-default-config branch 2 times, most recently from 9628fd7 to ea33222 Compare August 24, 2016 08:49
@wallyworld
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Aug 24, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Aug 24, 2016

Build failed: Generating tarball failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/8911

@wallyworld
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Aug 24, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit c08e079 into juju:master Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants