Merge lp:~themue/juju-core/go-cmd-firewall into lp:~juju/juju-core/trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~themue/juju-core/go-cmd-firewall |
Merge into: | lp:~juju/juju-core/trunk |
Diff against target: |
850 lines (+825/-2) 3 files modified
cmd/cmd_test.go (+5/-2) cmd/firewall.go (+472/-0) cmd/firewall_test.go (+348/-0) |
To merge this branch: | bzr merge lp:~themue/juju-core/go-cmd-firewall |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+114212@code.launchpad.net |
Description of the change
cmd: added port of state/firewall.py
The port of the current Python firewall has been moved to
the cmd package because it's only used by the provisioning
agent. The implementation is split into several subtypes
and done, the tests are done for services.
THIS PROPOSAL IS STILL EVOLVING.
Unmerged revisions
- 266. By Frank Mueller
-
cmd: added port of state/firewall.py
- 265. By Frank Mueller
-
state: preparing for trunk merging
- 264. By Frank Mueller
-
cmd: prepared firewall testing
- 263. By Frank Mueller
-
cmd: added initial version of the firewall
- 262. By Dave Cheney
-
state: machine.InstanceId error proposal
machine.InstanceId returns NoInstanceIdError when
there is no instance id set in the machine *ConfigNode.R=niemeyer
CC=
https://codereview. appspot. com/6297105 - 261. By Gustavo Niemeyer
-
mstate: update to the mgo API version r2012.06.22
This was already reviewed in:
https:/
/code.launchpad .net/~niemeyer/ juju-core/ store-update- mgo/+merge/ 111546 But Launchpad simply can't serve that branch without errors anymore. :-(
- 260. By Gustavo Niemeyer
-
store: update mgo API to r2012.06.22
R=rog
CC=
https://codereview. appspot. com/6327049 - 259. By Frank Mueller
-
state: adding of FlagWatcher and integration into Service
The port of Firewall (in a different CL) needs the implementation
of the FlagWatcher and its integration into Service to watch the
exposed flag. Both is done in this CL.R=niemeyer
CC=
https://codereview. appspot. com/6332048 - 258. By Roger Peppe
-
cmd/jujud: make provisioner use StateInfo from environment.
This means we can pass in a localhost address to the provisioning
agent and it will nonetheless use the correct address for zookeeper
when firing up clients.Some rearrangement of testing code was necessary too.
R=niemeyer
CC=
https://codereview. appspot. com/6336047 - 257. By Dave Cheney
-
environs/dummy: enhance start/stop operations
This is an alternate proposal to enhance dummy to return
the actual environ.Instance objects created during
Start/StopInstance operations.This would be used in the PA tests to double check that
m, err := s.st.AddMachine(n); m.InstanceId matches the
Instance.Id() provided by dummy.R=niemeyer
CC=
https://codereview. appspot. com/6304104
some initial superficial comments.
i'm still mulling it over.
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go
File cmd/firewall.go (right):
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode1
cmd/firewall.go:1: package cmd
this is the wrong place for this code.
given that it's really just part of the provisioning agent, it should be
alongside the PA code, in cmd/jujud, or the provisioning package,
if/when that happens.
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode14
cmd/firewall.go:14: type Ports []state.Port
i'm not sure that this type or its methods deserve export.
not exporting the type means that environs implementors don't
necessarily need to depend on this package.
since we're talking about a set of ports, i wonder if
map[state.Port]bool might be a nicer representation.
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode55 instanceId string, machineId int) (Ports,
cmd/firewall.go:55: OpenPorts(
error)
i wonder if just "Ports" might be better here.
the name OpenPorts seems to suggest it's just a version of OpenPort that
opens more than one port.
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode106 go:106: // startd the watchers of the services exposed
cmd/firewall.
flag.
s/startd/starts/
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode159 go:159: func (fw *Firewall) tsOnMachineObse rver(observer func(int)) {
cmd/firewall.
AddOpenClosePor
i'm not sure i understand the use-case for this function. isn't
observing ports exactly what all this code is about? why do we need
another hook? if it's about testing, i'd have thought that the
PortsManager interface should give us a sufficient interface.
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode280 go:280: type serviceExposedW atcher struct { Watcher below.
cmd/firewall.
see comment on newServiceUnits
serviceExposedP ortManager, perhaps?
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode332 go:332: }
cmd/firewall.
i think this may read better:
sew.exposed = exposed Watcher( sew.fw, sew)
if exposed {
sew.suw = newServiceUnits
}
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode360 go:360: // the passed service. Manager, perhaps?
cmd/firewall.
this isn't really a watcher in the sense of the other watchers in state.
more of a serviceUnitPort
https:/ /codereview. appspot. com/6374047/ diff/1/ cmd/firewall. go#newcode414 go:414: type unitPortsWatcher struct {
cmd/firewall.
unitPortManager?
https:/ /codereview. appspot. com/6374047/