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
Conversation
@@ -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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
c33dc2a
to
0d95cef
Compare
return nil, errors.Trace(err) | ||
} | ||
fields := schema.FieldMap(providerDefaults.ProviderConfig(), providerDefaults.ProviderConfigDefaults()) | ||
if coercedAtts, err := fields.Coerce(defaults, nil); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Atts/Attrs/ ?
Please add TODO(wallyworld) to have environs.EnvironProvider embed config.ConfigSource (sic), making it required, and drop the interface assertions. |
LGTM with a few niggles |
9628fd7
to
ea33222
Compare
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
Build failed: Generating tarball failed |
ea33222
to
8b8f609
Compare
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
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