Does it not make sense to change the things that depend on the storage
to just depend on the storage and not the entire environment, then you
don't need to mock out the Storage method.
Obviously here the important thing is that we want to use a particular
storage for bootstrap, so I'd expect to be assigning the
bootstrapStorage to a storage variable, not mocking out the method with
a different structure.
> This is only for testing, but I will fix it anyway. I think
localstorage ought
> to be renamed httpstorage, and have the backend contain one of these.
https://codereview.appspot.com/13635044/diff/14001/environs/manual/agent.go#newcode82
environs/manual/agent.go:82: err := environs.FinishMachineConfig(mcfg,
args.envcfg, constraints.Value{})
I fear that using names like "envcfg" means that we have more and more
assumed knowledge encoded into our variable names. Here I like some
parts of the Zen of Python "Explicit is better than implicit", yes it is
python, but I think the principle holds.
https://codereview.appspot.com/13635044/diff/14001/environs/manual/bootstrap.go#newcode28
environs/manual/bootstrap.go:28: bootstrap.BootstrapStorager
Arg, here I know that I'm going to clash on names with Rog, but IMO
BootstrapStorager
is a terrible name.
HasBootstrapStorage
makes a lot more sense to me. Firstly you can look at the name and know
what is going on, and we aren't inventing words to go by the weird idea
that interfaces should end with "er".
bootstrapStorage, ok := sometype.(HasBootstrapStorage)
reads ok to me (FSVO ok given the syntax of the type assertion).
Still some changes needed here I think
https:/ /codereview. appspot. com/13635044/ diff/14001/ cmd/juju/ bootstrap. go bootstrap. go (right):
File cmd/juju/
https:/ /codereview. appspot. com/13635044/ diff/14001/ cmd/juju/ bootstrap. go#newcode76 bootstrap. go:76: environ = &bootstrapStora geEnviron{ environ,
cmd/juju/
bootstrapStorage}
If all we are caring about is the storage, why are we changing the
environ?
Does it not make sense to change the things that depend on the storage
to just depend on the storage and not the entire environment, then you
don't need to mock out the Storage method.
Obviously here the important thing is that we want to use a particular
storage for bootstrap, so I'd expect to be assigning the
bootstrapStorage to a storage variable, not mocking out the method with
a different structure.
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ bootstrap/ bootstrap. go bootstrap/ bootstrap. go (right):
File environs/
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ bootstrap/ bootstrap. go#newcode24 bootstrap/ bootstrap. go:24: // BootstrapStorager is an interface interface. go
environs/
that returns a environs.Storage that may
On 2013/09/14 07:28:03, rog wrote:
> I think I'd define this inside environs/
> This package doesn't define or use it, and that file
> is a useful reference for people implementing providers.
Agreed. It is something that is used by the environment, so it makes
more sense to live there.
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ filestorage/ filestorage. go filestorage/ filestorage. go (right):
File environs/
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ filestorage/ filestorage. go#newcode110 filestorage/ filestorage. go:110: file, err := ge-"+name) filesystems problem.
environs/
ioutil.TempFile("", "juju-filestora
On 2013/09/13 09:41:26, axw1 wrote:
> On 2013/09/13 09:24:59, fwereade wrote:
> > Same different-
> This is only for testing, but I will fix it anyway. I think
localstorage ought
> to be renamed httpstorage, and have the backend contain one of these.
That sounds like a good idea IMO
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ manual/ agent.go manual/ agent.go (right):
File environs/
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ manual/ agent.go# newcode82 manual/ agent.go: 82: err := environs. FinishMachineCo nfig(mcfg, Value{} )
environs/
args.envcfg, constraints.
I fear that using names like "envcfg" means that we have more and more
assumed knowledge encoded into our variable names. Here I like some
parts of the Zen of Python "Explicit is better than implicit", yes it is
python, but I think the principle holds.
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ manual/ bootstrap. go manual/ bootstrap. go (right):
File environs/
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ manual/ bootstrap. go#newcode28 manual/ bootstrap. go:28: bootstrap. BootstrapStorag er rager Storage
environs/
Arg, here I know that I'm going to clash on names with Rog, but IMO
BootstrapSto
is a terrible name.
HasBootstrap
makes a lot more sense to me. Firstly you can look at the name and know
what is going on, and we aren't inventing words to go by the weird idea
that interfaces should end with "er".
bootstrapStorage, ok := sometype. (HasBootstrapSt orage)
reads ok to me (FSVO ok given the syntax of the type assertion).
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ manual/ sshresponse_ test.go manual/ sshresponse_ test.go (right):
File environs/
https:/ /codereview. appspot. com/13635044/ diff/14001/ environs/ manual/ sshresponse_ test.go# newcode53 manual/ sshresponse_ test.go: 53: return PatchEnvironmen t("PATH" , fakebin+ ":"+os. Getenv( "PATH") )
environs/
testing.
I've been thinking of better ways to get test code to clean up after
itself.
If we had an interface called: (func() )
type TestCleanup interface {
AddCleanup
we could then have this function take an interface pointer,
and instead of returning a function that the caller needs to defer,
you could just go:
func sshresponse(c *gc.C, cleaner testing. TestCleanup, input, output AddCleanup( testing. PatchEnvironmen t("PATH" , ":"+os. Getenv( "PATH") ))
string, rc int) {
// everything else
cleaner.
fakebin+
}
https:/ /codereview. appspot. com/13635044/ diff/14001/ worker/ localstorage/ config. go localstorage/ config. go (right):
File worker/
https:/ /codereview. appspot. com/13635044/ diff/14001/ worker/ localstorage/ config. go#newcode4 localstorage/ config. go:4: package storage
worker/
why is the package "storage" when the directory is "localstorage" ?
This kind of goes against a lot of our coding standards.
https:/ /codereview. appspot. com/13635044/ diff/14001/ worker/ localstorage/ worker. go localstorage/ worker. go (right):
File worker/
https:/ /codereview. appspot. com/13635044/ diff/14001/ worker/ localstorage/ worker. go#newcode54 localstorage/ worker. go:54: sharedStorageDir := osenv.JujuShare dStorageDir)
worker/
os.Getenv(
I think these have all been moved into the agent config now.
Changes may have been lost during the move from the old directory.
https:/ /codereview. appspot. com/13635044/