Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Specify a default cloud name in lxd provider #6735
Conversation
|
!!Chittychitty!! |
jameinel
reviewed
Dec 20, 2016
I have a small niggle about what the function looks like, thoughts?
| @@ -598,7 +607,7 @@ func (c *bootstrapCommand) handleCommandLineErrorsAndInfoRequests(ctx *cmd.Conte | ||
| return false, nil | ||
| } | ||
| -func (c *bootstrapCommand) cloud(ctx *cmd.Context) (*jujucloud.Cloud, error) { | ||
| +func (c *bootstrapCommand) cloud(ctx *cmd.Context) (string, *jujucloud.Cloud, error) { |
jameinel
Dec 20, 2016
Owner
It seems a little odd that "cloudName" takes precedence over the Cloud object.
Also, I probably would have thought you would do
cloud.Name()
at some later time, rather than having this 'cloud' object do the indirection to find the preferred default name.
(or possibly DefaultCloudName(cloudObject))
Then you could even just do:
c.Cloud = DefaultCloudName(cloudObject)
and the other code wouldn't have to change?
babbageclunk
Dec 20, 2016
•
Member
Do you mean that the name gets returned first? To me it reads like returning the name and the value - that's why I picked that ordering.
I thought about adding Name to Cloud. This makes the most sense to me, but it has implications for serialisation that I'm not happy about - should I also add Name to the internal cloud type for marshalling? I don't want to change the format of clouds.yaml. Adding Name.Cloud but then only populating it on the way through this function seems confusing too.
I toyed with just changing c.Cloud but decided it was nasty to mutate the bootstrapCommand as a side-effect of returning a Cloud, which is why I returned the name instead.
babbageclunk
added some commits
Dec 20, 2016
|
Added Cloud.Name as suggested by @jameinel and @perrito666 - you guys were right, it's much cleaner. !!chittychitty!! |
|
LGTM |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
babbageclunk
referenced this pull request
Jan 4, 2017
Merged
Specify a default cloud name in lxd provider (backport) #6760
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
babbageclunk commentedDec 20, 2016
This means that even if the controller is bootstrapped using the
provider name "lxd" rather than the built-in cloud name "localhost", the
cloud will be created with the name localhost. Migrating between controllers
where one was bootstrapped with "lxd" and the other with "localhost" works.
Fixes https://bugs.launchpad.net/juju/+bug/1650251
QA steps:
localhostas the cloud.lxd.