Change the Openstack Storage service (Swift) openstack_service_type default value from
"object-store" to ["object-store"].
The problem with "object-store" as an openstack_service_type is that if the
Swift service is unavailable, the authenticate_v2 method will attempt to call:
service_type.join ", "
This will fail for anything that isn't an array.
Changing the openstack_service_type to an array solves this problem.
Additionally, it keeps the openstack_service_type consistent with all of the
other Openstack services' openstack_service_type default values.
https://github.com/fog/fog/issues/3112
Current implementation will fail of OpenStack is required
by itself because of Fog::XML::Connection. Prefer to use
JSON in any event. Replaced with Fog::Core::Connection.
Unlike last attempt this replaces Fog::Connection with
Fog::XML::Connection which should be directly compatible.
Fog::Connection is there for old PRs but should be removed real soon.
Providers using JSON should be able to replace "XML" with "Core" within
their code to cut down on the dependency.
If I get the time I may attempt to clean up some but testing with Mock
will mean that is mostly educated guesswork.
Fog::Connection mixed in XML parsing via the `parser` argument which
wasn't much use for the majority of APIs using JSON.
This adds the deprecation warning and attempts to update providers to
the correct version of Connection that they need.
Either the cleaner `Fog::Core::Connection` or if reliant on the XML
parsing still `Fog::XML::SAXParserConnection`
The SAX parser will be moving to `fog/xml` fairly soon.
Following work on reorganising the requires, there was an inconsistent
approach to where service wrappers are required. (Fog::Compute...)
Since they should be standardised and shared across providers (although
they really aren't yet) they have been moved to `fog-core` gem.
Each provider has their own `lib/fog/{provider}/core` files that is
required by each of their services. These files should all require
`fog/core` which already required most or these.
So this removes the extra cases to concentrate them in core.
Renames the current #put_object_manifest method to better differentiate
this from the new #put_static_obj_manifest method. #put_object_manifest
has been retained for backward compatibility.
The patch would allow to impersonate other accounts if you have
an admin role:
require 'fog'
require 'pp'
auth_url = 'https://identity.test.lan/v2.0/tokens'
user = 'admin@test.lan'
password = 'secret'
id = Fog::Identity.new :provider => 'OpenStack',
:openstack_auth_url => auth_url,
:openstack_username => user,
:openstack_api_key => password
st = Fog::Storage.new :provider => 'OpenStack',
:openstack_auth_url => auth_url,
:openstack_username => user,
:openstack_api_key => password
id.tenants.each do |t|
puts "Changing account to #{t.name}"
st.change_account "AUTH_#{t.id}"
# list account containers
pp st.directories
# We could also head the account and get usage information
pp st.request :method => 'HEAD'
end
Porting Fog Rackspace Storage service to OpenStack.
Mostly replaced names, removed CDN stuff (perhaps Rackspace specific)
and used authenticate_v2 (keystone).