[PATCH conductor] Temporary Bugfix for adding providers.

Jason Guiditta jguiditt at redhat.com
Wed May 9 21:00:45 UTC 2012


This needs to be addressed better later on, but for some reason, the
previously commited code is not working as expected for checking if a
provider has the correct name entered in conductor.  For Ec2 example,
this would verify that, say, 'us-east-1' is valid.  Currently, this
returns a 500 saying 'aws requires authorization for this request'.
Yet when I run the same command directly against the dc client in a
rails console, it works as expected.  This is just a validation, so
I propose just disabling it for now, in the interest of being able to
have an end-of-sprint minor release.  This can be revisited in the
near future.
---
 src/app/models/provider.rb       |    4 ++--
 src/spec/models/provider_spec.rb |    8 --------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index fc3040e..09a9ca0 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -252,7 +252,7 @@ class Provider < ActiveRecord::Base
   def validate_provider
     if !nil_or_empty(url)
       errors.add("url", I18n.t("activerecord.errors.provider.url")) unless valid_framework?
-      errors.add("deltacloud_provider", I18n.t("activerecord.errors.provider.deltacloud_provider")) unless valid_provider?
+      #errors.add("deltacloud_provider", I18n.t("activerecord.errors.provider.deltacloud_provider")) unless valid_provider?
     end
   end
 
@@ -266,7 +266,7 @@ class Provider < ActiveRecord::Base
     if !nil_or_empty(deltacloud_provider)
       client = connect
       return false if client.nil?
-      return false unless client.valid_provider? deltacloud_provider
+      return false unless client.driver(provider_type.deltacloud_driver).valid_provider? deltacloud_provider
     end
     true
   end
diff --git a/src/spec/models/provider_spec.rb b/src/spec/models/provider_spec.rb
index 4d07f9d..d4b9894 100644
--- a/src/spec/models/provider_spec.rb
+++ b/src/spec/models/provider_spec.rb
@@ -65,14 +65,6 @@ describe Provider do
       @provider.should_not be_valid
     end
 
-    it "should set error if unable to connect to specified deltacloud_provider" do
-      @provider.stub(:valid_provider?).and_return(false)
-      @provider.stub(:valid_framework?).and_return(true)
-      @provider.should have(1).error_on(:deltacloud_provider)
-      @provider.errors[:deltacloud_provider].first.should eql(I18n.t("activerecord.errors.provider.deltacloud_provider"))
-      @provider.should_not be_valid
-    end
-
     it "should require unique name" do
       @provider.save!
       provider2 = Factory.build :mock_provider
-- 
1.7.7.6




More information about the aeolus-devel mailing list