The 'connection' accessor in collections and models actually refered to
a subclassed instance of Fog::Service which creates confusion in the
code.
References to 'connection' could have meant the service or the
Fog::Connection held within that service.
This deprecates the connection accessor and replaces it with `#service`
as a read only value. When a collection or model is initalised then
service should be passed.
This commit also updates all the changes to @connection made by
providers in model initialisers since these depending on the presence of
the 'connection' key. The key is still accepted by outputs a warning.
In many places we were checking for identity which was the shorthand for
checking if the resource had been saved by the service.
The #persisted? method was added to show a clearer intent and also offer
minimal ActiveModel interface
Altered the paths for EC2 credential requests to remove an extra / in
the request URIs.
Altered Fog::Open::Identity::Real#request to retry only once when given
a 401 error response code. The EC2 API returns 401 when attempting to
fetch nonexistent EC2 credentials instead of something sensible like
404, leading to an infinite loop. Also, the "Bad username or password"
check was removed. My version of OpenStack does not return this message
when a token is expired, but returns the same message as for a missing
EC2 credential.
User#roles should be calling Service#list_roles_for_user_on_tenant
directly and not use Roles#all since the latter is actually a method
for getting all roles in the Identity Service