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

Issue 12343045: charm: allow empty strings as config values (Closed)

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

Description

charm: allow empty strings as config values This is the second CL for lp:1194945. It allows empty strings as valid values for config options with the type string. Merging should be done after none has signalled a compatibility problem as answer to the query mail on the mailing list. https://code.launchpad.net/~themue/juju-core/037-empty-strings-in-charm-config/+merge/178318 Requires: https://code.launchpad.net/~themue/juju-core/036-set-default/+merge/178279 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -18 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M charm/config.go View 2 chunks +2 lines, -2 lines 3 comments Download
M charm/config_test.go View 5 chunks +12 lines, -9 lines 1 comment Download
M cmd/juju/config_test.go View 1 chunk +7 lines, -0 lines 0 comments Download
M state/service_test.go View 1 chunk +0 lines, -4 lines 0 comments Download
M state/statecmd/config_test.go View 2 chunks +2 lines, -3 lines 1 comment Download

Messages

Total messages: 4
mue
Please take a look.
10 years, 9 months ago (2013-08-02 15:02:57 UTC) #1
dimitern
LGTM
10 years, 9 months ago (2013-08-02 15:59:33 UTC) #2
jameinel
LGTM
10 years, 9 months ago (2013-08-08 16:57:55 UTC) #3
fwereade
10 years, 9 months ago (2013-08-09 13:19:05 UTC) #4
Sorry, NOT LGTM without explanation. The API has lost/changed functionality, I
think, because we can no longer set string values to defaults; and we've now got
two ways to set defaults for non-string types. How is all this going to work in
the imminent CLI-API world?

https://codereview.appspot.com/12343045/diff/1/charm/config.go
File charm/config.go (right):

https://codereview.appspot.com/12343045/diff/1/charm/config.go#newcode39
charm/config.go:39: // are always considered valid, and empty string values are
converted to nil.
This isn't true any more.

https://codereview.appspot.com/12343045/diff/1/charm/config.go#newcode48
charm/config.go:48: } else if option.Type != "string" && value == "" {
Why are we keeping this behaviour? Having `value=` mean different things
depending on type seems like a bad idea to me. Can't we just delete this whole
special-case block?

https://codereview.appspot.com/12343045/diff/1/charm/config.go#newcode67
charm/config.go:67: if option.Type != "string" && str == "" {
Similarly.

https://codereview.appspot.com/12343045/diff/1/charm/config_test.go
File charm/config_test.go (right):

https://codereview.appspot.com/12343045/diff/1/charm/config_test.go#newcode337
charm/config_test.go:337: info: "empty strings are nil values for non-string
types",
Yeah -- why do we now have two ways of specifying set-to-default? I don't think
this is a good idea *unless* we have to support `value=` for python
compatibility.

https://codereview.appspot.com/12343045/diff/1/state/statecmd/config_test.go
File state/statecmd/config_test.go (right):

https://codereview.appspot.com/12343045/diff/1/state/statecmd/config_test.go#...
state/statecmd/config_test.go:90: "value":       "",
So how do we set defaults over the API?
Sign in to reply to this message.

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