Descriptionstate: refactor addmachine.go
The current code had become a twisty maze. This
change is intended to make things somewhat more
straightforward.
The key insight is that there are only four
pathways through the code that require
different control flow:
- adding a top level machine
- adding a top level machine with associated instance id
- adding a machine within an existing machine
- adding a machine within a newly created machine
Each of these pathways now has its own function.
One pathway was catered for by the old code
but is not by the new: adding a machine within
a machine with associated instance id.
I don't believe that's a case we need to be
bothered about (and it's easy to add if we are).
For the time being, I have kept the external interface
identical, but I'd like to change it to be a little
more like the above set of functions, rather
than having a single set of AddMachineParams
suitable for every case.
https://code.launchpad.net/~rogpeppe/juju-core/463-state-ensure-availability/+merge/196177
(do not edit description out of merge proposal)
Patch Set 1 #Patch Set 2 : state: refactor addmachine.go #Patch Set 3 : state: refactor addmachine.go #
Total comments: 4
Patch Set 4 : state: refactor addmachine.go #
Total comments: 12
Patch Set 5 : state: refactor addmachine.go #
MessagesTotal messages: 7
|