On the Client Side, We Can Install a Ruby Gem Named Fog. In This Example, We Will Use OS X 10.10.1 as Client and HP Cloud as Cloud Service Provider. Obviously, we can use Python Swift Client to manage OpenStack Swift. Fog has extensive guides.
Manage OpenStack Swift With Fog (HP Cloud) : OS X Part
Our quite popular guide – iTerm2, Homebrew and ZSH Installation on OS X is the first step to get started. Next steps are :
1 |
curl -L get.rvm.io | bash -s stable |
Sadly, two more profile files will be created apart from .zshrc
, they are :
---
1 2 3 |
~/.bash_profile ~/.profile ~/.zlogin |
You’ll run cat against these :
1 2 3 |
cat ~/.bash_profile cat ~/.profile cat ~/.zlogin |
practically they’ll have this :
1 2 3 |
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* |
WE WILL DELETE :
1 2 3 |
rm ~/.bash_profile rm ~/.profile rm ~/.zlogin |
AS WE HAVE ONLY ONE DOT FILE – .zshrc
. We will only depend on .zshrc
. Source it :
1 |
source ~/.zshrc |
Next, we will run these commands :
1 2 3 |
brew update source ~/.rvm/scripts/rvm rvm requirements |
Then :
1 2 3 |
brew install libksba rvm install ruby-2.0.0-p598 rvm user all && rvm install ruby-2.0.0 --with-gcc=clang |
last two steps are :
1 |
rvm use 2.0.0 --default && gem install fog |
You should be able to install the gem properly. This is a fixed instruction for OS X Mavericks. 1.9.2 will give you error :
1 2 3 4 |
RVM does not know how to build working ruby-1.9.2-p330 on OSX 10.10, if you know please let us know by opening a ticket with instructions here: https://github.com/wayneeseguin/rvm/issues |
Manage OpenStack Swift With Fog : HP Cloud Part
Its pretty easy :
1 2 3 4 5 6 |
irb -r 'rubygems' irb -r 'fog' irb # you'll get an interactive session require 'rubygems' require 'fog' |
require 'rubygems'
and require 'fog'
should return true
as output. Example configuration goes like this :
1 2 3 4 5 6 7 8 9 10 11 12 |
def credentials_hash { :provider => :hp, :hp_auth_uri => ENV['OS_AUTH_URL'], :hp_access_key => ENV['OS_USER'], :hp_secret_key => ENV['OS_API_KEY'], :hp_tenant_id => ENV['OS_TENANT'] , :hp_avl_zone => ENV['OS_REGION'] } end storage = Fog::<SERVICE-NAME>.new(credentials_hash) |
The
can be Fog::Storage.new()
, which is a variable string. It can be cdn, compute etc. You will get question answers on Fog on StackOverflow > http://stackoverflow.com/questions/tagged/fog
. Better specific guides can be found on HP’s website itself :
1 |
https://dev.hpcloud.com/ruby/sdk-connect.html |
On OS X, installation can go hugely painful due to UNIX wheel group. Problem arises mainly from Homebrew part with OS X Mavericks. Fog is exactly not as painless as Python Swift Client for current version of OS X but it can become your solution for the need.
Here’s what we’ve got for you which might like :
Additionally, performing a search on this website can help you. Also, we have YouTube Videos.
Take The Conversation Further ...
We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!
If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.
Contact Us