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

Issue 6548051: worker/firewaller: fix for new state

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by niemeyer
Modified:
11 years, 7 months ago
Reviewers:
mp+125778, TheMue, dave, rog
Visibility:
Public.

Description

worker/firewaller: fix for new state https://code.launchpad.net/~niemeyer/juju-core/new-state-firewaller/+merge/125778 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : worker/firewaller: fix for new state #

Total comments: 11

Patch Set 3 : worker/firewaller: fix for new state #

Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -109 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M juju/testing/conn.go View 1 chunk +4 lines, -0 lines 0 comments Download
M state/service.go View 1 chunk +2 lines, -2 lines 0 comments Download
M state/service_test.go View 1 2 2 chunks +7 lines, -17 lines 0 comments Download
M state/state_test.go View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M state/tools_test.go View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M state/unit.go View 1 2 1 chunk +5 lines, -3 lines 0 comments Download
M state/unit_test.go View 1 2 2 chunks +30 lines, -38 lines 0 comments Download
M worker/firewaller/firewaller.go View 1 2 7 chunks +36 lines, -15 lines 0 comments Download
M worker/firewaller/firewaller_test.go View 11 chunks +26 lines, -34 lines 0 comments Download

Messages

Total messages: 5
niemeyer
Please take a look.
11 years, 7 months ago (2012-09-21 17:50:57 UTC) #1
TheMue
LGTM, shows again the nice effect of using MongoDB. Great decision.
11 years, 7 months ago (2012-09-21 17:57:00 UTC) #2
dave_cheney.net
LGTM. Minor quibbles. https://codereview.appspot.com/6548051/diff/2001/state/service_test.go File state/service_test.go (right): https://codereview.appspot.com/6548051/diff/2001/state/service_test.go#newcode71 state/service_test.go:71: c.Assert(s.service.IsExposed(), Equals, false) This is fine, ...
11 years, 7 months ago (2012-09-21 17:57:36 UTC) #3
rog
LGTM modulo the below https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller.go File worker/firewaller/firewaller.go (right): https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller.go#newcode283 worker/firewaller/firewaller.go:283: watcher: machine.WatchPrincipalUnits(), // FIXME THIS ...
11 years, 7 months ago (2012-09-21 18:00:24 UTC) #4
niemeyer
11 years, 7 months ago (2012-09-21 18:36:44 UTC) #5
*** Submitted:

worker/firewaller: fix for new state

R=TheMue, dfc, rog
CC=
https://codereview.appspot.com/6548051

https://codereview.appspot.com/6548051/diff/2001/state/service_test.go
File state/service_test.go (right):

https://codereview.appspot.com/6548051/diff/2001/state/service_test.go#newcode71
state/service_test.go:71: c.Assert(s.service.IsExposed(), Equals, false)
On 2012/09/21 17:57:36, dfc wrote:
> This is fine, and I encourage this terser form. Does this represent a new
> standard for err Asserts ?

I've seen this in a few places already. I also think it's fine in terse cases
like this.

https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller.go
File worker/firewaller/firewaller.go (right):

https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller...
worker/firewaller/firewaller.go:283: watcher:    machine.WatchPrincipalUnits(),
// FIXME THIS MUST WATCH *ALL* UNITS.
On 2012/09/21 17:57:36, dfc wrote:
> // TODO(niemeyer) is more traditional.

As discussed, BUG/FIXME generally means something else than TODO. I've added the
(niemeyer) bit, though.

https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller...
worker/firewaller/firewaller.go:363: change := unit.OpenedPorts()
On 2012/09/21 18:00:24, rog wrote:
> i think it would be reasonable for state.OpenedPorts to return the ports in
> sorted order (it does define SortPorts after all).

Sounds good. Done.

https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller...
worker/firewaller/firewaller.go:368: ports = append([]state.Port(nil),
change...)
On 2012/09/21 18:00:24, rog wrote:
> do we need to do this? after all, OpenedPorts is already making a copy to
return
> it.

Without the copy the same data is used from two different goroutines.

https://codereview.appspot.com/6548051/diff/2001/worker/firewaller/firewaller...
worker/firewaller/firewaller.go:378: // portsChanged returns whether old and new
contain the same set ports.
On 2012/09/21 18:00:24, rog wrote:
> s/set ports/set of ports/
> 
> but i think portsEqual would be easier to understand,
> the comment would actually be correct, and the
> test above would not need to be negated.

Done.
Sign in to reply to this message.

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