I haven't reviewed everything, this should keep you going for a while
though.
In general: we should not be dropping any tests that are not
*guaranteed* to never work. Since UpdateEnvironConfig is not completely
fixed yet, the tests should remain. This may involve hacking around
validation with a nil policy.
https://codereview.appspot.com/70190050/diff/60001/cmd/juju/environment_test.go#newcode173
cmd/juju/environment_test.go:173: c.Check(err, gc.ErrorMatches, `no
registered provider for "foo"`)
This has nothing to do with attribute mutability, so doesn't belong
here. Why not just change the value in the map to a real provider type?
You will need to make sure the provider is registered by importing its
package.
https://codereview.appspot.com/70190050/diff/60001/environs/config.go#newcode138
environs/config.go:138: func Provider(providerType string)
(EnvironProvider, error) {
Making cosmetic changes is fine, but it's best not to mix cosmetic
changes (or refactoring) with functional changes. Otherwise I'm
scrutinising everything to make sure there's no functional change, and
the review takes longer than necessary.
https://codereview.appspot.com/70190050/diff/60001/juju/conn_test.go#newcode152
juju/conn_test.go:152: // Removing the secret from state should not be
possible, as
Well, that's only true for the dummy provider. Real providers don't have
defaults for secrets. For a real provider you'd have a different
problem: validation would fail because a config without the secrets is
invalid.
In this test it makes sense to disable validation while you're removing
the attribute.
I haven't reviewed everything, this should keep you going for a while
though.
In general: we should not be dropping any tests that are not
*guaranteed* to never work. Since UpdateEnvironConfig is not completely
fixed yet, the tests should remain. This may involve hacking around
validation with a nil policy.
https:/ /codereview. appspot. com/70190050/ diff/60001/ cmd/juju/ environment. go environment. go (right):
File cmd/juju/
https:/ /codereview. appspot. com/70190050/ diff/60001/ cmd/juju/ environment. go#newcode166 environment. go:166: return UpdateEnvironCo nfig(c. values, []string{})
cmd/juju/
conn.State.
Just nil is fine.
https:/ /codereview. appspot. com/70190050/ diff/60001/ cmd/juju/ environment_ test.go environment_ test.go (right):
File cmd/juju/
https:/ /codereview. appspot. com/70190050/ diff/60001/ cmd/juju/ environment_ test.go# newcode173 environment_ test.go: 173: c.Check(err, gc.ErrorMatches, `no
cmd/juju/
registered provider for "foo"`)
This has nothing to do with attribute mutability, so doesn't belong
here. Why not just change the value in the map to a real provider type?
You will need to make sure the provider is registered by importing its
package.
https:/ /codereview. appspot. com/70190050/ diff/60001/ environs/ config. go
File environs/config.go (right):
https:/ /codereview. appspot. com/70190050/ diff/60001/ environs/ config. go#newcode138 config. go:138: func Provider( providerType string)
environs/
(EnvironProvider, error) {
Making cosmetic changes is fine, but it's best not to mix cosmetic
changes (or refactoring) with functional changes. Otherwise I'm
scrutinising everything to make sure there's no functional change, and
the review takes longer than necessary.
https:/ /codereview. appspot. com/70190050/ diff/60001/ environs/ testing/ tools.go testing/ tools.go (right):
File environs/
https:/ /codereview. appspot. com/70190050/ diff/60001/ environs/ testing/ tools.go# newcode447 testing/ tools.go: 447: err = st.UpdateEnviro nConfig( attrs, string] interface{ }{"ssl- hostname- verification" : fication}
environs/
[]string{})
Just pass in the one attribute in a new map. FYI, you can make maps with
map literals like so:
map[
SSLHostnameVeri
https:/ /codereview. appspot. com/70190050/ diff/60001/ juju/conn. go
File juju/conn.go (right):
https:/ /codereview. appspot. com/70190050/ diff/60001/ juju/conn. go#newcode155 UpdateEnvironCo nfig(attrs, []string{})
juju/conn.go:155: return c.State.
Just pass secrets here, and don't bother updating attrs in the loop.
https:/ /codereview. appspot. com/70190050/ diff/60001/ juju/conn_ test.go
File juju/conn_test.go (right):
https:/ /codereview. appspot. com/70190050/ diff/60001/ juju/conn_ test.go# newcode152 test.go: 152: // Removing the secret from state should not be
juju/conn_
possible, as
Well, that's only true for the dummy provider. Real providers don't have
defaults for secrets. For a real provider you'd have a different
problem: validation would fail because a config without the secrets is
invalid.
In this test it makes sense to disable validation while you're removing
the attribute.
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/api/ firewaller/ state_test. go firewaller/ state_test. go (right):
File state/api/
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/api/ firewaller/ state_test. go#newcode94 firewaller/ state_test. go:94: // TODO [waigani] test removing
state/api/
an attribute.
I don't think deferral is warranted here. Not sure it's really necessary
to add the test either, though: firewaller doesn't care about attributes
being removed.
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/apiserver /client/ client. go /client/ client. go (right):
File state/apiserver
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/apiserver /client/ client. go#newcode775 /client/ client. go:775: oldConfig, err := EnvironConfig( ) nfig...
state/apiserver
c.api.state.
This is a bit ugly, requiring another load. I wonder if we could pass an
additional validation function down to UpdateEnvironCo
Just a thought, not blocking.
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/apiserver /client/ client. go#newcode785 /client/ client. go:785: // TODO [waigani] Add a txn retry
state/apiserver
loop
We have a standard format for TODOs:
// TODO(user) YYYY-MM-DD #issue
// A brief summary of the issue here.
Please file an issue if there's not one already (I think the one I
referred to in state.go is suitable, so just refer to that).
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/apiserver /client/ client. go#newcode786 /client/ client. go:786: return UpdateEnvironCo nfig(args. Config, []string{})
state/apiserver
c.api.state.
The second argument can simply be nil.
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/apiserver /keymanager/ keymanager. go /keymanager/ keymanager. go (left):
File state/apiserver
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/apiserver /keymanager/ keymanager. go#oldcode311 /keymanager/ keymanager. go:311: // For now, authorised
state/apiserver
keys are global, common to all users.
This comment didn't need to be deleted
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/state. go
File state/state.go (left):
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/state. go#oldcode265 haven't- changed
state/state.go:265: // TODO(axw) 2013-12-6 #1167616
The TODO will not be resolved until the settings-
assertion is in place. Please do not delete it until then,.
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/state. go
File state/state.go (right):
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/state. go#newcode259
state/state.go:259: // DELETE ME
DELETE ME
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/state. go#newcode305 New(config. NoDefaults,
state/state.go:305: oldConfig, err := config.
existingAttrs)
I think there's no reason not to inline settings.Map() here.
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/testing/ config. go config. go (right):
File state/testing/
https:/ /codereview. appspot. com/70190050/ diff/60001/ state/testing/ config. go#newcode10 config. go:10: // TODO [waigani] replace UpdateConfig with
state/testing/
UpdateEnvironConfig
Please either do it or create a TODO(waigaini) with accompanying issue.
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ environ_ test.go environ_ test.go (left):
File worker/
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ environ_ test.go# oldcode49 environ_ test.go: 49: // Create an invalid config by taking the
worker/
current config and
This shouldn't go until UpdateEnvironConfig is completely fixed.
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ firewaller/ firewaller_ test.go firewaller/ firewaller_ test.go (left):
File worker/
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ firewaller/ firewaller_ test.go# oldcode135 firewaller/ firewaller_ test.go: 135: // has bootstrapped.
worker/
Winner!
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ instancepoller/ observer_ test.go instancepoller/ observer_ test.go (left):
File worker/
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ instancepoller/ observer_ test.go# oldcode51 instancepoller/ observer_ test.go: 51: oldType = type"]. (string)
worker/
attrs["
Again, don't delete until UpdateEnvironConfig is fixed. Open a state
conn with nil validator here if you have to.
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ machineenvironm entworker/ machineenvironm entworker_ test.go machineenvironm entworker/ machineenvironm entworker_ test.go
File worker/
(right):
https:/ /codereview. appspot. com/70190050/ diff/60001/ worker/ machineenvironm entworker/ machineenvironm entworker_ test.go# newcode128 machineenvironm entworker/ machineenvironm entworker_ test.go: 128: interface{ }{} string] interface{ })
worker/
attrs := map[string]
The conventional way to write this is
attrs := make(map[
https:/ /codereview. appspot. com/70190050/