Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1638)

Issue 11409043: Unify providers' user-data composition functions. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by jtv.canonical
Modified:
10 years, 8 months ago
Reviewers:
mp+175191, mue, dimitern, fwereade, rog
Visibility:
Public.

Description

Unify providers' user-data composition functions. All the "physical" providers (EC2, OpenStack, MAAS, Azure) were generating user data in essentially the same way. The MAAS one looked different but actually just added an optional bit that was still completely generic. And so this branch unifies the implementations. Construction of the cloudinit.MachineConfig was lifted out of the function. That may seem arbitrary, but it's part of a greater plan: in a later step of the ongoing refactoring the construction can be lifted out of the providers' internalStartInstance methods as well, doing away with the EC2 and OpenStack providers' startInstanceParams structs. This actually shortens some of the data flows and reduces cognitive load, which can only be good for maintenance. After that step we can have a fresh look at sanitizing NewMachineConfig (which arguably should take more parameters, or not exist at all, but is in an intermediate state that facilitates the changes happening now). We may also look into re-introducing some sort of dedicated Parameter Object for internalStartInstance, but by then the cluster of methods Bootstrap / StartInstance / internalStartInstance will look a bit different and we can find the most maintainable solution for that new situation. https://code.launchpad.net/~jtv/juju-core/regularize-userdata-function/+merge/175191 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : Unify providers' user-data composition functions. #

Total comments: 1

Patch Set 3 : Unify providers' user-data composition functions. #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+112 lines, -181 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M environs/azure/customdata.go View 1 chunk +3 lines, -18 lines 1 comment Download
M environs/azure/customdata_test.go View 1 2 3 chunks +3 lines, -25 lines 1 comment Download
M environs/cloudinit.go View 1 2 chunks +20 lines, -0 lines 1 comment Download
M environs/cloudinit_test.go View 1 3 chunks +60 lines, -0 lines 0 comments Download
M environs/ec2/ec2.go View 1 3 chunks +10 lines, -24 lines 0 comments Download
M environs/maas/environ.go View 1 chunk +3 lines, -1 line 0 comments Download
M environs/maas/util.go View 2 chunks +0 lines, -23 lines 0 comments Download
M environs/maas/util_test.go View 1 2 chunks +0 lines, -66 lines 0 comments Download
M environs/openstack/provider.go View 3 chunks +11 lines, -24 lines 0 comments Download

Messages

Total messages: 10
jtv.canonical
Please take a look.
10 years, 9 months ago (2013-07-17 03:56:58 UTC) #1
jtv.canonical
Please take a look.
10 years, 9 months ago (2013-07-17 06:11:57 UTC) #2
fwereade
LGTM. Very nice indeed. https://codereview.appspot.com/11409043/diff/4001/environs/azure/customdata_test.go File environs/azure/customdata_test.go (right): https://codereview.appspot.com/11409043/diff/4001/environs/azure/customdata_test.go#newcode55 environs/azure/customdata_test.go:55: c.Check(err, gc.ErrorMatches, "failure while generating ...
10 years, 9 months ago (2013-07-17 08:51:52 UTC) #3
jtv.canonical
OK, I'm checking for the entire error message now.
10 years, 9 months ago (2013-07-17 11:01:24 UTC) #4
jtv.canonical
Please take a look.
10 years, 9 months ago (2013-07-17 11:04:44 UTC) #5
mue
Cool change, LGTM. Only one very small commment. https://codereview.appspot.com/11409043/diff/11001/environs/cloudinit.go File environs/cloudinit.go (right): https://codereview.appspot.com/11409043/diff/11001/environs/cloudinit.go#newcode9 environs/cloudinit.go:9: cloudinit_core ...
10 years, 9 months ago (2013-07-17 11:13:58 UTC) #6
dimitern
LGTM as well, thanks for doing this. Can we consider the bug mentioned in the ...
10 years, 9 months ago (2013-07-17 11:23:12 UTC) #7
dimitern
LGTM as well, thanks for doing this. Can we consider the bug mentioned in the ...
10 years, 9 months ago (2013-07-17 11:23:12 UTC) #8
jtv.canonical
This doesn't close that whole bug, no, but it resolves one part of the duplication ...
10 years, 9 months ago (2013-07-17 11:30:27 UTC) #9
rog
10 years, 9 months ago (2013-07-17 14:04:31 UTC) #10
LGTM but i think perhaps environs/cloudinit would be a better place for the new
function.

https://codereview.appspot.com/11409043/diff/11001/environs/azure/customdata.go
File environs/azure/customdata.go (right):

https://codereview.appspot.com/11409043/diff/11001/environs/azure/customdata....
environs/azure/customdata.go:17: zipData, err := environs.ComposeUserData(cfg)
just a thought: rather than environs.ComposeUserData,
why not put the function in environs/cloudinit,
as it's directly related to cloudinit stuff,

something like this, perhaps? (in environs/cloudinit)

func UserData(*cloudinit.Config) ([]byte, error)

https://codereview.appspot.com/11409043/diff/11001/environs/azure/customdata_...
File environs/azure/customdata_test.go (left):

https://codereview.appspot.com/11409043/diff/11001/environs/azure/customdata_...
environs/azure/customdata_test.go:58: func (*CustomDataSuite)
TestUserDataProducesZipFile(c *gc.C) {
when we've removed this, are we still left with a test that we are actually
calling ComposeUserData correctly?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b