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

Issue 6442051: state: factor out getConfigString and setConfigString

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

Description

state: factor out getConfigString and setConfigString This code was repeated in quite a few places with minor (and IMHO mostly unjustified) variations. We're about to add more calls (version and proposed-version), which hopefully should justify this even more. https://code.launchpad.net/~rogpeppe/juju-core/state-getconfigstring/+merge/116871 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: factor out getConfigString and setConfigString #

Total comments: 20

Patch Set 3 : state: factor out getConfigString and setConfigString #

Patch Set 4 : state: factor out getConfigString and setConfigString #

Total comments: 10

Patch Set 5 : state: factor out getConfigString and setConfigString #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -100 lines) Patch
A [revision details] View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M state/confignode.go View 1 2 1 chunk +43 lines, -0 lines 0 comments Download
M state/machine.go View 1 2 3 4 2 chunks +10 lines, -25 lines 0 comments Download
M state/machine_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/relation.go View 1 2 1 chunk +1 line, -5 lines 0 comments Download
M state/relation_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/service.go View 1 2 3 4 1 chunk +8 lines, -17 lines 0 comments Download
M state/unit.go View 1 2 3 4 1 chunk +16 lines, -49 lines 0 comments Download
M state/unit_test.go View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 5
rog
Please take a look.
11 years, 9 months ago (2012-07-26 14:05:14 UTC) #1
niemeyer
That's a huge improvement, thanks. A few details: https://codereview.appspot.com/6442051/diff/2001/state/confignode.go File state/confignode.go (right): https://codereview.appspot.com/6442051/diff/2001/state/confignode.go#newcode120 state/confignode.go:120: func ...
11 years, 9 months ago (2012-07-26 16:27:21 UTC) #2
rog
Please take a look. https://codereview.appspot.com/6442051/diff/2001/state/confignode.go File state/confignode.go (right): https://codereview.appspot.com/6442051/diff/2001/state/confignode.go#newcode120 state/confignode.go:120: func getConfigString(zk *zookeeper.Conn, path, what ...
11 years, 9 months ago (2012-07-26 17:17:28 UTC) #3
niemeyer
LGTM with the following fixed: https://codereview.appspot.com/6442051/diff/7002/state/machine.go File state/machine.go (right): https://codereview.appspot.com/6442051/diff/7002/state/machine.go#newcode57 state/machine.go:57: "instance id of machine ...
11 years, 9 months ago (2012-07-26 18:21:25 UTC) #4
rog
11 years, 9 months ago (2012-07-26 18:31:00 UTC) #5
*** Submitted:

state: factor out getConfigString and setConfigString

This code was repeated in quite a few places with minor (and
IMHO mostly unjustified) variations. We're about to add more
calls (version and proposed-version), which hopefully should
justify this even more.

R=niemeyer
CC=
https://codereview.appspot.com/6442051

https://codereview.appspot.com/6442051/diff/7002/state/machine.go
File state/machine.go (right):

https://codereview.appspot.com/6442051/diff/7002/state/machine.go#newcode57
state/machine.go:57: "instance id of machine %v", m.String())
On 2012/07/26 18:21:25, niemeyer wrote:
> s/m.String()/m/

Done.

https://codereview.appspot.com/6442051/diff/7002/state/machine.go#newcode65
state/machine.go:65: "instance id of machine %v", m.String())
On 2012/07/26 18:21:25, niemeyer wrote:
> s/m.String()/m/

Done.

https://codereview.appspot.com/6442051/diff/7002/state/service.go
File state/service.go (right):

https://codereview.appspot.com/6442051/diff/7002/state/service.go#newcode34
state/service.go:34: return nil, fmt.Errorf("failed to parse charm URL of
service %q: %v", err)
On 2012/07/26 18:21:25, niemeyer wrote:
> Wrong number of arguments.

Done.

https://codereview.appspot.com/6442051/diff/7002/state/unit.go
File state/unit.go (right):

https://codereview.appspot.com/6442051/diff/7002/state/unit.go#newcode159
state/unit.go:159: return nil, fmt.Errorf("failed to parse charm URL of unit %q:
%v", err)
On 2012/07/26 18:21:25, niemeyer wrote:
> Wrong number of arguments.

Done.

https://codereview.appspot.com/6442051/diff/7002/state/unit.go#newcode167
state/unit.go:167: "charm URL of unit %v", u)
On 2012/07/26 18:21:25, niemeyer wrote:
> s/%v/%q/

Done.
Sign in to reply to this message.

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