1151.1.1
|
|
|
Tim Penhey |
11 years ago
|
|
|
1151
|
|
environs: extract tools package
This is much simpler than it looks. Motivation is as follows:
1) I'm trying to make our tools logic consistent, so we have some sort of chance of different parts of the system acting in concert (bootstrap, start-instance, sync-tools, upgrade-juju, juju upgrades, ...?). It is currently very difficult to build a mental model of how these things are related, and a common vocabulary will help.
2) I'd be crazy to try to do everything at once (ha!). So I'll leave the existing tools *selection* logic (FindTools, BestTools) in place while I focus on just uploads/downloads.
3) Move tool-storagey code from environs to environs/tools:
* environs.listTools -> tools.ReadList (environs.ListTools now uses tools.ReadList) * environs.PutTools -> tools.Upload (lots of code moved to storage.go and build.go in tools/) * environs.ToolsStoragePath -> tools.StorageName (it's a name, not a path, according to the storage metaphor)
...hmm. Lots of renames.
4) But wait, I can't do this, I need to use environs.Storage, and there's an import loop. To keep the diff small, define tools.URLLister and tools.URLPutter.
6) The tests are starting to look somewhat repetitive, and I fear subtle differences creeping in. Let's bulk up environs/testing a little. Ah, that's better.
From a review perspective, this branch is largely mechanical. The only code that is new, as opposed to moved or mechanically replaced, is:
* the tests for tools.ReadList (made explicit now it's exported). * the tests for environs.EmptyStorage (yes, it's trivial. yes, it should still be tested.) * environs/testing/tools.go (mostly new, and used in several places). * UpgradeJujuCommand (surprising behaviour corrected, clarifying test added).
R=thumper, dimitern CC= https://codereview.appspot.com/8545043
|
William Reade |
11 years ago
|
|
|
1150
|
|
|
Jeroen Vermeulen |
11 years ago
|
|
|
1149
|
|
|
Dimiter Naydenov |
11 years ago
|
|
|
1148
|
|
|
Dimiter Naydenov |
11 years ago
|
|
|
1147
|
|
|
Roger Peppe |
11 years ago
|
|
|
1146
|
|
|
Roger Peppe |
11 years ago
|
|
|
1145
|
|
|
Dimiter Naydenov |
11 years ago
|
|
|
1144
|
|
|
Dimiter Naydenov |
11 years ago
|
|
|
1143
|
|
|
Dave Cheney |
11 years ago
|
|
|
1142
|
|
|
Tim Penhey |
11 years ago
|
|
|
1141
|
|
|
Tim Penhey |
11 years ago
|
|
|
1140
|
|
|
William Reade |
11 years ago
|
|
|
1139
|
|
|
Roger Peppe |
11 years ago
|
|
|
1138
|
|
|
Roger Peppe |
11 years ago
|
|
|
1137
|
|
|
Dimiter Naydenov |
11 years ago
|
|
|
1136
|
|
|
Dimiter Naydenov |
11 years ago
|
|
|
1135
|
|
|
Gustavo Niemeyer |
11 years ago
|
|
|
1134
|
|
|
Данило Шеган |
11 years ago
|
|
|
1133
|
|
|
Gustavo Niemeyer |
11 years ago
|
|
|