[PATCH conductor] BZ 865833 - Prevent editting vsphere provider name

jzigmund at redhat.com jzigmund at redhat.com
Thu Oct 18 15:43:55 UTC 2012


From: Jozef Zigmund <jzigmund at redhat.com>

Used the same way as for rhevm provider name

https://bugzilla.redhat.com/show_bug.cgi?id=865833
---
 src/app/models/provider.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index fb2ac84..24828e1 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -74,7 +74,9 @@ class Provider < ActiveRecord::Base
           false
         end
       when "RHEV-M"
-        load_rhevm_json(name)
+        load_json(name, "rhevm")
+      when "VMware vSphere"
+        load_json(name, "vsphere")
       when "Amazon EC2"
         if name.starts_with?("ec2-")
           true
@@ -300,8 +302,8 @@ class Provider < ActiveRecord::Base
     true
   end
 
-  def load_rhevm_json(provider_name)
-    path_to_json = "/etc/imagefactory/rhevm.json"
+  def load_json(provider_name, provider_type)
+    path_to_json = "/etc/imagefactory/#{provider_type}.json"
     if File.exists?(path_to_json)
       json = File.read(path_to_json)
       json_hash = ActiveSupport::JSON.decode(json)
-- 
1.7.11.7




More information about the aeolus-devel mailing list