New API call, Controller.HostedModelConfig #6315

Merged
merged 5 commits into from Sep 26, 2016

Conversation

Projects
None yet
3 participants
Owner

howbazaar commented Sep 26, 2016

This new API call is used in an upcoming PR that adds a timeout to the kill-controller command. Once the timeout is hit, the client will attempt to destroy all the models by talking to the provider directly. To do this, it needs to have the model's config and cloud config in order to be able to instantiate an Environ.

The facade version is not bumped as it is no danger to the client. If the client is newer than the server, which is possible for early RCs, then a timeout of 5 minutes will happen before the provider is invoked directly. The call will fail with NotImplemented, so will cause no further damage. kill-controller was written with the ability to call it more than once, so running the command again is expected behaviour.

Contributor

mjs commented Sep 26, 2016

Needs QA steps. In particular, have you tested an rc1 client with an rc2 server and vice versa?

My primary concern is about lack of QA steps as per my other comment.

api/common/cloudspec/cloudspec.go
+ return api.MakeCloudSpec(result.Result)
+}
+
+func (api *CloudSpecAPI) MakeCloudSpec(pSpec *params.CloudSpec) (environs.CloudSpec, error) {
@mjs

mjs Sep 26, 2016

Contributor

docstring

apiserver/controller/controller.go
+// HostedModelConfig returns all the information that the client needs
+// in order to connect directly with the host model's provider and destroy
+// it directly.
+func (s *ControllerAPI) HostedModelConfig() (params.HostedModelConfigResults, error) {
@mjs

mjs Sep 26, 2016

Contributor

This confused me a bit at first. The name made me think it would return the config for one hosted model, but it doesn't take any args. How about calling it HostedModelConfigs?

apiserver/params/model.go
@@ -22,6 +22,24 @@ type ModelConfigResults struct {
Config map[string]ConfigValue `json:"config"`
}
+// HostedModelConfig contains the model config and the cloud spec
+// for the model, both things that the CLI needs to talk directly
@mjs

mjs Sep 26, 2016

Contributor

s/the CLI/a client/

There are no QA steps for this branch because it is only adding a facade call. The next branch has the QA steps.

api/common/cloudspec/cloudspec.go
+ return api.MakeCloudSpec(result.Result)
+}
+
+func (api *CloudSpecAPI) MakeCloudSpec(pSpec *params.CloudSpec) (environs.CloudSpec, error) {
@mjs

mjs Sep 26, 2016

Contributor

docstring

apiserver/controller/controller.go
+// HostedModelConfig returns all the information that the client needs
+// in order to connect directly with the host model's provider and destroy
+// it directly.
+func (s *ControllerAPI) HostedModelConfig() (params.HostedModelConfigResults, error) {
@mjs

mjs Sep 26, 2016

Contributor

This confused me a bit at first. The name made me think it would return the config for one hosted model, but it doesn't take any args. How about calling it HostedModelConfigs?

apiserver/params/model.go
@@ -22,6 +22,24 @@ type ModelConfigResults struct {
Config map[string]ConfigValue `json:"config"`
}
+// HostedModelConfig contains the model config and the cloud spec
+// for the model, both things that the CLI needs to talk directly
@mjs

mjs Sep 26, 2016

Contributor

s/the CLI/a client/

mjs approved these changes Sep 26, 2016

Owner

howbazaar commented Sep 26, 2016

$$merge$$

Contributor

jujubot commented Sep 26, 2016

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

@jujubot jujubot merged commit d9373f5 into juju:master Sep 26, 2016

@howbazaar howbazaar deleted the howbazaar:kill-controller-timeout branch Sep 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment