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

Issue 6353092: map-backed Config type

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 10 months ago by fwereade
Modified:
11 years, 10 months ago
Reviewers:
dave, mp+114654, rog
Visibility:
Public.

Description

map-backed Config type The bulk of this diff is: * code moves -- breaking up the morass that is the dummy env, moving misplaced stuff like authorized-keys handling out of ec2, generally trying to put stuff in places that make sense * name changes -- ReadEnvironsBytes->NewConfigSet, etc * somewhat detailed tests for config handling and updating ...so it's not quite as big as it looks. But... it would appear that I Just Don't Get It :(. All this mucking around in maps seems to me to be profoundly ugly and *very* hard to get right (hence the large amount of seriously pedantic testing). I was led towards implementing config.ComposeConfig and config.Checker because of the otherwise *hideous* duplication between the dummy and ec2 environs; and the fact that *all* the tests in config would have to be dumped into ec2 and duplicated in all future providers. If you don't like this, and I wouldn't blame you if you didn't, I'm not sure what else I can do. I really tried... (Incidentally... I just don't know whether I'm following sensible practices here. If I don't tidy code as I go I get nice clean diffs and we end up with a tangled morass of code after a few weeks (witness state tests, dummy environs, etc); if I do tidy as I go we get tangled diffs but a chance at gradually improving code consistency. Anyone?) https://code.launchpad.net/~fwereade/juju-core/env-config-trainwreck/+merge/114654 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : map-backed Config type #

Total comments: 30
Unified diffs Side-by-side diffs Delta from patch set Stats (+1592 lines, -1036 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/cmd_test.go View 1 chunk +5 lines, -3 lines 2 comments Download
A environs/config/config.go View 1 chunk +187 lines, -0 lines 1 comment Download
M environs/config/config_test.go View 3 chunks +280 lines, -16 lines 2 comments Download
A environs/config/export_test.go View 1 chunk +5 lines, -0 lines 0 comments Download
A environs/configset.go View 1 chunk +87 lines, -0 lines 0 comments Download
M environs/configset_test.go View 6 chunks +40 lines, -36 lines 0 comments Download
M environs/dummy/environs.go View 6 chunks +41 lines, -232 lines 1 comment Download
M environs/dummy/environs_test.go View 1 chunk +5 lines, -6 lines 0 comments Download
A environs/dummy/provider.go View 1 chunk +230 lines, -0 lines 4 comments Download
M environs/dummy/storage.go View 1 chunk +7 lines, -6 lines 0 comments Download
D environs/ec2/auth.go View 1 chunk +0 lines, -75 lines 0 comments Download
D environs/ec2/config_test.go View 1 chunk +0 lines, -233 lines 0 comments Download
M environs/ec2/ec2.go View 6 chunks +55 lines, -70 lines 3 comments Download
M environs/ec2/export_test.go View 1 chunk +0 lines, -4 lines 0 comments Download
M environs/ec2/live_test.go View 2 chunks +11 lines, -15 lines 1 comment Download
M environs/ec2/local_test.go View 2 chunks +16 lines, -17 lines 0 comments Download
M environs/ec2/provider.go View 1 chunk +82 lines, -68 lines 1 comment Download
A environs/ec2/provider_test.go View 1 chunk +353 lines, -0 lines 3 comments Download
M environs/interface.go View 5 chunks +11 lines, -25 lines 4 comments Download
M environs/jujutest/test.go View 3 chunks +16 lines, -14 lines 2 comments Download
D environs/open.go View 1 chunk +0 lines, -46 lines 0 comments Download
M environs/provider.go View 1 chunk +46 lines, -106 lines 3 comments Download
M environs/provider_test.go View 1 chunk +43 lines, -44 lines 0 comments Download
M environs/tools_test.go View 2 chunks +3 lines, -3 lines 0 comments Download
M juju/conn.go View 1 chunk +13 lines, -9 lines 0 comments Download
M schema/schema.go View 1 chunk +14 lines, -2 lines 2 comments Download
M schema/schema_test.go View 1 chunk +20 lines, -0 lines 0 comments Download
M service/provisioner/provisioner.go View 3 chunks +17 lines, -5 lines 1 comment Download
M service/provisioner/provisioner_test.go View 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 6
fwereade
Please take a look.
11 years, 10 months ago (2012-07-12 15:25:14 UTC) #1
rog
Generally I think this looks pretty good. The stuff in ec2 could be done more ...
11 years, 10 months ago (2012-07-12 17:31:04 UTC) #2
fwereade
Thanks, that's reassuring :). Haven't fixed any of these yet, but I have a bit ...
11 years, 10 months ago (2012-07-12 22:53:33 UTC) #3
fwereade
https://codereview.appspot.com/6353092/diff/2001/environs/interface.go File environs/interface.go (right): https://codereview.appspot.com/6353092/diff/2001/environs/interface.go#newcode92 environs/interface.go:92: SetConfig(*config.Config) error On 2012/07/12 22:53:34, fwereade wrote: > On ...
11 years, 10 months ago (2012-07-12 23:05:29 UTC) #4
dave_cheney.net
Lovely work. https://codereview.appspot.com/6353092/diff/2001/environs/config/config.go File environs/config/config.go (right): https://codereview.appspot.com/6353092/diff/2001/environs/config/config.go#newcode1 environs/config/config.go:1: package config very nice. https://codereview.appspot.com/6353092/diff/2001/environs/config/config_test.go File environs/config/config_test.go ...
11 years, 10 months ago (2012-07-13 02:18:37 UTC) #5
fwereade
11 years, 10 months ago (2012-07-13 16:41:54 UTC) #6
On 2012/07/13 02:18:37, dfc wrote:
> Lovely work.
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/config/config.go
> File environs/config/config.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/config/config.go#ne...
> environs/config/config.go:1: package config
> very nice.
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/config/config_test.go
> File environs/config/config_test.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/config/config_test....
> environs/config/config_test.go:26: err := os.Mkdir(dotssh, 0777)
> nit: .ssh is usually 0700, sshd will reject it if someone other than the owner
> can modify files inside it. As this is a test, this is probably not relevant.
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/config/config_test....
> environs/config/config_test.go:31: err = os.Mkdir(alt, 0777)
> ditto
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/dummy/environs.go
> File environs/dummy/environs.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/dummy/environs.go#n...
> environs/dummy/environs.go:212: return e.cfg.Map()["broken"].(bool)
> Do you think there is value in adding convenience methods on config for (say)
> string and bool types to avoid calling Map() ?
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/ec2/ec2.go
> File environs/ec2/ec2.go (right):
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/ec2/ec2.go#newcode82
> environs/ec2/ec2.go:82: // mu protects all other fields below.
> > change them back if you like, but I'd be interested to know what "Unlocked"
> > indicates that is not implicitly true about every field on every type :).
> 
> This was at the request of Gustavo. The `Unlocked` prefix is supposed to warn
> you that if you touch them without `unlocking` them first via grabbing the
> mutex, you're a naughty boy.
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/ec2/live_test.go
> File environs/ec2/live_test.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/ec2/live_test.go#ne...
> environs/ec2/live_test.go:54: Name:             "",
> Blank ?
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/ec2/provider.go
> File environs/ec2/provider.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/ec2/provider.go#new...
> environs/ec2/provider.go:75: secretKey, _ := final["secret-key"].(string)
> damn I love the zero value.
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/ec2/provider_test.go
> File environs/ec2/provider_test.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/ec2/provider_test.g...
> environs/ec2/provider_test.go:26: err := os.Mkdir(dotssh, 0777)
> nit: access bits.
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/interface.go
> File environs/interface.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/interface.go#newcode92
> environs/interface.go:92: SetConfig(*config.Config) error
> LGTM.
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/jujutest/test.go
> File environs/jujutest/test.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/jujutest/test.go#ne...
> environs/jujutest/test.go:22: Configs *environs.ConfigSet
> nit: Config, or CS maybe
> 
>
https://codereview.appspot.com/6353092/diff/2001/environs/jujutest/test.go#ne...
> environs/jujutest/test.go:55: Configs *environs.ConfigSet
> as above
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/provider.go
> File environs/provider.go (right):
> 
> https://codereview.appspot.com/6353092/diff/2001/environs/provider.go#newcode9
> environs/provider.go:9: type Provider interface {
> I don't think this ads much value to move it around, everything is in one pkg
> from godoc's point of view.
> 
>
https://codereview.appspot.com/6353092/diff/2001/service/provisioner/provisio...
> File service/provisioner/provisioner.go (right):
> 
>
https://codereview.appspot.com/6353092/diff/2001/service/provisioner/provisio...
> service/provisioner/provisioner.go:100: newcfg, err :=
> environs.ComposeConfig(cfg, node.Map())
> I do like the name ComposeConfig.

Dave, thanks very much for the review, but rog has a far nicer approach IMO so
I'm dropping this. Sorry to waste your time :(.
Sign in to reply to this message.

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