From de4574200ed0e321a8785ecf77fd6352e69a708c Mon Sep 17 00:00:00 2001 From: Sean Handley Date: Sun, 29 Apr 2012 20:50:06 +0100 Subject: [PATCH] Need these to run the server love tests. --- lib/fog/bin.rb | 1 + lib/fog/bin/serverlove.rb | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 lib/fog/bin/serverlove.rb diff --git a/lib/fog/bin.rb b/lib/fog/bin.rb index af4852a21..f42e076b6 100644 --- a/lib/fog/bin.rb +++ b/lib/fog/bin.rb @@ -75,6 +75,7 @@ require 'fog/bin/ninefold' require 'fog/bin/rackspace' require 'fog/bin/openstack' require 'fog/bin/ovirt' +require 'fog/bin/serverlove' require 'fog/bin/slicehost' require 'fog/bin/stormondemand' require 'fog/bin/terremark' diff --git a/lib/fog/bin/serverlove.rb b/lib/fog/bin/serverlove.rb new file mode 100644 index 000000000..62b722d3c --- /dev/null +++ b/lib/fog/bin/serverlove.rb @@ -0,0 +1,31 @@ +class Serverlove < Fog::Bin + class << self + + def class_for(key) + case key + when :compute + Fog::Compute::Serverlove + else + raise ArgumentError, "Unrecognized service: #{key}" + end + end + + def [](service) + @@connections ||= Hash.new do |hash, key| + hash[key] = case key + when :compute + Fog::Logger.warning("Serverlove[:compute] is not recommended, use Compute[:serverlove] for portability") + Fog::Compute.new(:provider => 'Serverlove') + else + raise ArgumentError, "Unrecognized service: #{key.inspect}" + end + end + @@connections[service] + end + + def services + Fog::Serverlove.services + end + + end +end