On Fri, Feb 8, 2013 at 7:53 PM, David Lutterkort <[email protected]> wrote:
> Hi Chip,
>
> fun ! The fact that you don't have a provider at the point where you
> print it, isn't an issue; what you pass into Deltacloud::new (defined on
> line 127 in lib/deltacloud/api.rb) is an options hash, which contains
> user/password for credentials, but also the provider.
>
> The provider does not wind up in the credentials, but in
> Thread.current[:provider], which you should access within your driver by
> calling api_provider (lib/deltacloud/drivers/base_driver.rb:278)
OK - makes sense now. Thanks.
>
> It seems this needs slightly better docs :(
Perhaps I can help with that, once I get some traction with this
driver. A new person coming into a project is often the best person
to tell you where the docs need help. ;-)
> Also, to keep credentials and the like out of the code that will get
> checked in, you should create a file ${HOME}/.deltacloud/config and put
> the following in it (it's a YAML file):
>
> cloudstack:
> user: USERNAME
> password: PASSWORD
> provider: SOME_URL
> mock:
> user: mockuser
> password: mockpassword
> provider: compute
>
> (you can put more credentials in there for ec2 etc.)
>
> In your test, load the credentials for your driver with
> Deltacloud::Test::config.credentials("cloudstack")
> (tests/test_helper.rb:81) - actually, I see it doesn't pull out the
> provider from the config file; it would actually be a good idea to add a
> method driver to Deltacloud::Test::Config:
>
> def driver(name)
> params = @hash[name.to_s]
> raise "No config for driver #{name}" unless params
> Deltacloud::new(name, params)
> end
>
> so that you can just say 'driver =
> Deltacloud::Test::config.driver(:cloudstack)' in your tests and get a
> driver that is setup according to your ~/.deltacloud/config.
Perfect... I thought there might be something like that for credentials.
Onward to getting an instance list to return!
-chip