We shouldn't be iterating like this anyway, I just realised -- if
there's any reason to iterate, there's reason to reread state inside the
loop.
https://codereview.appspot.com/86010044/diff/30001/state/machine.go#newcode1072
state/machine.go:1072: // For some reason when using unique indices with
mgo, and
On 2014/04/10 15:48:10, rog wrote:
> The only output from a transaction is ErrAborted - we never get to
know whether
> the actual operations succeeded or not (because they might have been
executed on
> another machine).
> BTW if we asserted that the doc was missing, how could the insertion
fail?
Yeah, nil means that the transaction didn't fail -- not necessarily that
it succeeded. Hitherto this has only really been an issue wrt Insert vs
Update -- inserts are ignored if the doc exists, updates ignored if it
doesn't.
But, yeah -- if the mac address is the _id, how come the DocMissing is
not being triggered?
Looking very good, but I think the txn bits need a bit of work; and I
think the NotFound changes are bad. What's the motivation there?
https:/ /codereview. appspot. com/86010044/ diff/30001/ environs/ broker. go
File environs/broker.go (right):
https:/ /codereview. appspot. com/86010044/ diff/30001/ environs/ broker. go#newcode44 broker. go:44: NetworkName string
environs/
If we're commenting fields (+1 to that) let's have blank lines before
comments.
https:/ /codereview. appspot. com/86010044/ diff/30001/ errors/ errors. go
File errors/errors.go (right):
https:/ /codereview. appspot. com/86010044/ diff/30001/ errors/ errors. go#newcode38 errors. go:38: return ok || (err != nil && HasSuffix( err.Error( ), " not found"))
errors/
strings.
On 2014/04/10 15:48:10, rog wrote:
> why?
> this seems wrong to me.
Yeah, I'm not too keen on this myself.
https:/ /codereview. appspot. com/86010044/ diff/30001/ errors/ errors. go#newcode127 errors. go:127: return ok || (err != nil && HasSuffix( err.Error( ), " already exists"))
errors/
strings.
On 2014/04/10 15:48:10, rog wrote:
> same here.
Yeah, I has a scared.
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/address. go
File state/address.go (right):
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/address. go#newcode152 go:152: NetworkScope instance. NetworkScope
state/address.
`bson:",omitempty"`
hmm. Scope should really be on Network, shouldn't it...
That's probably not one for this CL, though.
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/address. go#newcode162 go:162: NetworkScope instance. NetworkScope
state/address.
`bson:",omitempty"`
ditto
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/apiserver /provisioner/ provisioner. go /provisioner/ provisioner. go (right):
File state/apiserver
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/apiserver /provisioner/ provisioner. go#newcode421 /provisioner/ provisioner. go:421: stateNetworks[i] = rams{
state/apiserver
state.NetworkPa
I'm wondering whether NetworkInfo is less overloaded -- the params
package confuses the issue a bit
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/machine. go
File state/machine.go (right):
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/machine. go#newcode829 go:829: type NetworkParams struct {
state/machine.
s/available on an instance/ I think -- and move these to networks.go?
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/machine. go#newcode1052 go:1052: for i := 0; i < 5; i++ {
state/machine.
On 2014/04/10 15:48:10, rog wrote:
> similar question to State.AddNetwork, why are we iterating here?
We shouldn't be iterating like this anyway, I just realised -- if
there's any reason to iterate, there's reason to reread state inside the
loop.
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/machine. go#newcode1072 go:1072: // For some reason when using unique indices with
state/machine.
mgo, and
On 2014/04/10 15:48:10, rog wrote:
> The only output from a transaction is ErrAborted - we never get to
know whether
> the actual operations succeeded or not (because they might have been
executed on
> another machine).
> BTW if we asserted that the doc was missing, how could the insertion
fail?
Yeah, nil means that the transaction didn't fail -- not necessarily that
it succeeded. Hitherto this has only really been an issue wrt Insert vs
Update -- inserts are ignored if the doc exists, updates ignored if it
doesn't.
But, yeah -- if the mac address is the _id, how come the DocMissing is
not being triggered?
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/state. go
File state/state.go (right):
https:/ /codereview. appspot. com/86010044/ diff/30001/ state/state. go#newcode1055 go:1055: switch err {
state/state.
if err == "oh noes connection fell over", we should return it instead of
just retrying repeatedly. Probably the case for the other construction
like this too.
https:/ /codereview. appspot. com/86010044/