Storage vs. PublicStorage
Ian Booth
ian.booth at canonical.com
Tue Mar 12 06:55:47 UTC 2013
On Tue 12 Mar 2013 16:17:50 EST, John Arbash Meinel wrote:
> ...
>
>> If an error occurs when checking a bucket, it moves on to the next
>> in the list.
>
>> The Openstack provider doesn't return nil, but does return
>> environs.EmptyStorage if no public bucket is specified (sorry, I
>> misremembered). A quick read of the code seems to indicate that nil
>> should have worked also, but clearly not if you got an error. So
>> try returning environs.EmptyStorage in your provider's
>> PublicStorage() method and see if findMongo still errors.
>
>
>
> StorageReader is an interface. And we are calling:
>
> url, err := findMongo(env.Storage(), vers)
> and inside that we have:
>
> names, err := store.List(path)
>
The code above is for the control bucket.
There's similar code for the public bucket:
url, err = findMongo(env.PublicStorage(), vers)
if err == nil {
return url
}
If err != nil, we just drop down to the next option.
StorageReader doesn't really come into it as such, besides being the return type
of the PublicStorage() method. If nil is returned there, findMongo copes ok I
think but looking more into it other business logic expects a non nil value for
environs.EmptyStorage is the correct return value.
> So either we should:
>
> a) teach findMongo to do:
> if store == nil { return "", fmt.Errorf(????)}
>
See above, we should use environs.EmptyStorage not nil.
>
> c) Change the API so that env.Storage() must return EmptyStorage [add
> a cross-environ test case for it]
>
+1. If there's no test to enforce the required semantic, we should have one.
More information about the Juju-dev
mailing list