Open Source Contribution – Fog OpenStack Adapter Public Urls

open_source_initiative_logoAt anynines we rely on the fog gem to interact with our OpenStack Swift installation and we’d like to help contribute to fog. In this case we wanted to implement a support feature for public url generation in the OpenStack provider. This feature was only mocked in the last version of the fog gem, but is crucial for gems like paperclip and carrierwave.

The Implementation

To solve the issue described above we decided to create a pull request to the fog repositories and implement the necessary methods to create public_urls.

The fog gem is structured in a way that it supports adding new cloud providers to the library. As we are interested in the HP provider we should have a look at the lib/fog/openstack subdirectory.

fog_logoEach provider subdirectory is structured in the same way. It contains a requests and models subdirectories. Since we’d like to implement public urls in the the storage module we need to add a request definition for this purpose. In a second step we add the correct request call to the directory model.

As I had no idea how to implement unit tests in this project I just submitted this pull request with a friendly request to the maintainers to implement the test suite and merge my pull request. They answered immediately, merged my request and added some refactoring and test suite for it.

Conclusion

It’s always a great experience to add new functionality to an Open Source project. In most cases the maintainers are happy about your support and enthusiasm and very willing to help you during the process. This was no different working with the fog project.

We hope to implement all needed methods in the fog OpenStack provider to fully support our Swift service installation, so we can switch all projects from the HP provider to the better matching and growing OpenStack provider.

Leave a Reply

Your email address will not be published.

*