The only reason that I can see is that manual/testing is a separate
package. Given that it's only imported from environs/manual, I don't see
what value that adds. I'd prefer to avoid unnecessary twisty
dependencies.
If we're going to deprecate reading config from environments.yaml,
that deserves its own CL, as there is a substantial amount
of cleanup that can and should happen then.
https://codereview.appspot.com/72860045/diff/2/errors/errors.go#newcode6
errors/errors.go:6: import "fmt"
On 2014/03/11 10:06:33, jameinel wrote:
> I actually prefer the other form.
> Because as soon as we need 2 imports, we want to do it anyway, and
that avoids
> having the noise of what actually changed confused with the extra
lines.
> Certainly not worth going around again, just wanted to give my feeling
that
> multiline imports are still reasonable to use when you only have one.
I think we shouldn't care too much. If goimports inserts a single
import, it does so without the ( ), and that's a useful enough tool that
I think it's reasonable to allow its default output through.
If we want to make it so that we can't open the API without a .jenv
file, that should be a deeper change in this file - there is a fair
amount of logic that can be simplified here.
https://codereview.appspot.com/72860045/diff/2/juju/conn_test.go#newcode88
juju/conn_test.go:88: s.PatchValue(&configstore.Exists, func(name
string) bool {
This seems wrong, as I've mentioned earlier.
It is not at all clear how patching this value will
affect any of the lines of code below - it's truly
action-at-a-distance, and hinges crucially on the
fact that the code calls Exists rather than using
the ReadInfo method to infer non-existence of an environment
info (which is a perfectly reasonable implementation).
https://codereview.appspot.com/72860045/diff/2/provider/joyent/config.go#newcode23
provider/joyent/config.go:23: # Can be set via env variables, or
specified here
We should be consistent in the juju init output. Both ec2 and azure have
the descriptions as full sentences. Something like this would seem
better to me (we should really mention the actual environment variables
used too):
# sdc-user holds the SDC user. It can also be specified in
# the SDC_ACCOUNT environment variable.
#
# sdc-user: <username>
A few more suggestions. It's great that we've lost the testing
dependencies from the code, but there are a few pieces I'm concerned
about.
https:/ /codereview. appspot. com/72860045/ diff/2/ environs/ manual/ init.go manual/ init.go (right):
File environs/
https:/ /codereview. appspot. com/72860045/ diff/2/ environs/ manual/ init.go# newcode21 manual/ init.go: 21: const DetectionScript = `#!/bin/bash dScript now need to be
environs/
I don't quite see why this and CheckProvisione
exported.
The only reason that I can see is that manual/testing is a separate
package. Given that it's only imported from environs/manual, I don't see
what value that adds. I'd prefer to avoid unnecessary twisty
dependencies.
https:/ /codereview. appspot. com/72860045/ diff/2/ environs/ open.go
File environs/open.go (right):
https:/ /codereview. appspot. com/72860045/ diff/2/ environs/ open.go# newcode93 open.go: 93: if source != ConfigFromInfo {
environs/
I think andrew has a point here - if ConfigForName returns a useful
error message, it will be lost.
If we're going to deprecate reading config from environments.yaml,
that deserves its own CL, as there is a substantial amount
of cleanup that can and should happen then.
https:/ /codereview. appspot. com/72860045/ diff/2/ errors/ errors. go
File errors/errors.go (right):
https:/ /codereview. appspot. com/72860045/ diff/2/ errors/ errors. go#newcode6
errors/errors.go:6: import "fmt"
On 2014/03/11 10:06:33, jameinel wrote:
> I actually prefer the other form.
> Because as soon as we need 2 imports, we want to do it anyway, and
that avoids
> having the noise of what actually changed confused with the extra
lines.
> Certainly not worth going around again, just wanted to give my feeling
that
> multiline imports are still reasonable to use when you only have one.
I think we shouldn't care too much. If goimports inserts a single
import, it does so without the ( ), and that's a useful enough tool that
I think it's reasonable to allow its default output through.
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/api. go
File juju/api.go (right):
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/api. go#newcode104 Exists( envName) {
juju/api.go:104: if !configstore.
As I mentioned in earlier comments, I don't think this is right.
If we want to make it so that we can't open the API without a .jenv
file, that should be a deeper change in this file - there is a fair
amount of logic that can be simplified here.
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/apiconn_ test.go test.go (right):
File juju/apiconn_
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/apiconn_ test.go# newcode257 test.go: 257: bootstrapEnv(c, &cs.CleanupSuite, SampleEnvName, store)
juju/apiconn_
coretesting.
This is changed only because of the unnecessary Exists patching AFAICS.
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/conn_ test.go
File juju/conn_test.go (right):
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/conn_ test.go# newcode88 test.go: 88: s.PatchValue( &configstore. Exists, func(name at-a-distance, and hinges crucially on the
juju/conn_
string) bool {
This seems wrong, as I've mentioned earlier.
It is not at all clear how patching this value will
affect any of the lines of code below - it's truly
action-
fact that the code calls Exists rather than using
the ReadInfo method to infer non-existence of an environment
info (which is a perfectly reasonable implementation).
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/osenv/ home.go
File juju/osenv/home.go (right):
https:/ /codereview. appspot. com/72860045/ diff/2/ juju/osenv/ home.go# newcode35 home.go: 35: func HaveJujuHome() bool {
juju/osenv/
Why do we have this?
Any client must call InitJujuHome. If they do not,
it is right to panic.
https:/ /codereview. appspot. com/72860045/ diff/2/ provider/ joyent/ config. go joyent/ config. go (right):
File provider/
https:/ /codereview. appspot. com/72860045/ diff/2/ provider/ joyent/ config. go#newcode23 joyent/ config. go:23: # Can be set via env variables, or
provider/
specified here
We should be consistent in the juju init output. Both ec2 and azure have
the descriptions as full sentences. Something like this would seem
better to me (we should really mention the actual environment variables
used too):
# sdc-user holds the SDC user. It can also be specified in
# the SDC_ACCOUNT environment variable.
#
# sdc-user: <username>
https:/ /codereview. appspot. com/72860045/ diff/2/ provider/ local/environpr ovider. go local/environpr ovider. go (right):
File provider/
https:/ /codereview. appspot. com/72860045/ diff/2/ provider/ local/environpr ovider. go#newcode232 local/environpr ovider. go:232: # Override the directory that is
provider/
used for the storage files and
# root-dir overrides the directory...
and below.
https:/ /codereview. appspot. com/72860045/ diff/2/ state/apiserver /charms. go /charms. go (right):
File state/apiserver
https:/ /codereview. appspot. com/72860045/ diff/2/ state/apiserver /charms. go#newcode32 /charms. go:32: utilsstorage net/juju- core/utils/ storage"
state/apiserver
"launchpad.
Why not just "storage" ?
https:/ /codereview. appspot. com/72860045/ diff/2/ state/apiserver /charms_ test.go /charms_ test.go (right):
File state/apiserver
https:/ /codereview. appspot. com/72860045/ diff/2/ state/apiserver /charms_ test.go# newcode27 /charms_ test.go: 27: utilsstorage net/juju- core/utils/ storage" storage/ ?
state/apiserver
"launchpad.
s/utilsstorage/
https:/ /codereview. appspot. com/72860045/ diff/2/ state/apiserver /client/ client_ test.go /client/ client_ test.go (right):
File state/apiserver
https:/ /codereview. appspot. com/72860045/ diff/2/ state/apiserver /client/ client_ test.go# newcode1802 /client/ client_ test.go: 1802: theStorage := Environ. Storage( )
state/apiserver
s.Conn.
please not the dreaded "the" convention!
Given that you've aliased both imports, you can
continue to use just "storage".
https:/ /codereview. appspot. com/72860045/ diff/2/ utils/http. go
File utils/http.go (right):
https:/ /codereview. appspot. com/72860045/ diff/2/ utils/http. go#newcode41 to(transport)
utils/http.go:41: registerFilePro
Why are we doing this?
It seems like a potential security hole to me - there's nothing in the
function documentation to state that the transport also serves files
from /.
https:/ /codereview. appspot. com/72860045/ diff/2/ utils/storage/ storage. go storage. go (right):
File utils/storage/
https:/ /codereview. appspot. com/72860045/ diff/2/ utils/storage/ storage. go#newcode16 storage. go:16: func GetEnvironStora ge(st *state.State)
utils/storage/
(storage.Storage, error) {
I don't think this package is justified for this trivial utility
function.
Why not just put the function inside environs?
https:/ /codereview. appspot. com/72860045/