cloudfoundry/cloud_controller_ng — pull request #49 by julweber (2013-05-31 04:40:39+00:00)
Title: Blob storage support for additional cloud storage providers (Tested on Openstack Swift)

Support for other Fog storage providers can be added easily.
As a use case we have tested CCNG to use OpenStack Swift as a blob storage.

The test process was to add the credentials of a OpenStack installation(Version Grizzly) and run CCNG's rspec against it.
A few minor issues mainly caused by internal inconsistencies of Fog had to be fixed.

Concrete: Behavior of Fog storage providers differs when it comes to file operations on cloud storage, for example when trying to delete non-existing files.
Some providers throw a NotFound error, others don't. NotFound errors of different providers do not share a common superclass.
Hence it is hard to catch them in a clean way.

As a workaround we had to change the according methods to pass the test suite which expects no exception to be raised when trying to delete non-existent files.
Since there's no common super-class for NotFound exceptions in Fog we have to catch a StandardError, analyze it and return true if the classname is NotFound. Other occuring exceptions are raised again.
We have created a Fog Github issue addressing this architectural flaw: https://github.com/fog/fog/issues/1848

Existing code comments in CCNG "fog doesn't have a unified interface for non-public urls" mentioned another issue.
The existing code assumed file.url to be present for non local files.
This assumption is not valid for non AWS providers such as the HP provider used to access the OpenStack Swift service (version grizzly).

Workaround:
The code is checking whether the provider module is responding to :url and calling it if available. In all other cases the public_url method is called, instead.