commit ddce3dc1409f452a901605c1a9c1dc840a198b77
Author: Amos Benari <abenari@redhat.com>
Date:   Wed Apr 30 15:49:37 2014 +0300

    fixes #4612 show friendly CR names, fix typo in oVirt name

diff --git a/app/helpers/compute_resources_helper.rb b/app/helpers/compute_resources_helper.rb
index 366757c9c..a246def8c 100644
--- a/app/helpers/compute_resources_helper.rb
+++ b/app/helpers/compute_resources_helper.rb
@@ -57,4 +57,11 @@ module ComputeResourcesHelper
   rescue
     []
   end
+
+  def list_providers
+    ComputeResource.providers.map do |provider|
+      [ComputeResource.provider_class(provider).constantize.provider_friendly_name, provider]
+    end
+  end
+
 end
diff --git a/app/models/compute_resource.rb b/app/models/compute_resource.rb
index 985ae08fd..23665af35 100644
--- a/app/models/compute_resource.rb
+++ b/app/models/compute_resource.rb
@@ -102,8 +102,13 @@ class ComputeResource < ActiveRecord::Base
     "#{name} (#{provider_friendly_name})"
   end
 
+  # Override this method to specify provider name
+  def self.provider_friendly_name
+    self.name.split('::').last()
+  end
+
   def provider_friendly_name
-    provider
+    self.class.provider_friendly_name
   end
 
   def image_param_name
@@ -187,7 +192,7 @@ class ComputeResource < ActiveRecord::Base
   end
 
   def console uuid = nil
-    raise ::Foreman::Exception.new(N_("%s console is not supported at this time"), provider)
+    raise ::Foreman::Exception.new(N_("%s console is not supported at this time"), provider_friendly_name)
   end
 
   # by default, our compute providers do not support updating an existing instance
diff --git a/app/models/compute_resources/foreman/model/gce.rb b/app/models/compute_resources/foreman/model/gce.rb
index 923286894..4b43c0b39 100644
--- a/app/models/compute_resources/foreman/model/gce.rb
+++ b/app/models/compute_resources/foreman/model/gce.rb
@@ -97,7 +97,7 @@ module Foreman::Model
       errors[:base] << e.message
     end
 
-    def provider_friendly_name
+    def self.provider_friendly_name
       "Google"
     end
 
diff --git a/app/models/compute_resources/foreman/model/openstack.rb b/app/models/compute_resources/foreman/model/openstack.rb
index 83a973741..0b4918dfa 100644
--- a/app/models/compute_resources/foreman/model/openstack.rb
+++ b/app/models/compute_resources/foreman/model/openstack.rb
@@ -90,7 +90,7 @@ module Foreman::Model
       client.flavors.get(flavor_ref).try(:name)
     end
 
-    def provider_friendly_name
+    def self.provider_friendly_name
       "OpenStack"
     end
 
diff --git a/app/models/compute_resources/foreman/model/ovirt.rb b/app/models/compute_resources/foreman/model/ovirt.rb
index fdbaddeef..0d81b2b2e 100644
--- a/app/models/compute_resources/foreman/model/ovirt.rb
+++ b/app/models/compute_resources/foreman/model/ovirt.rb
@@ -220,7 +220,7 @@ module Foreman::Model
       Host.authorized(:view_hosts, Host).where(:mac => vm.mac).first
     end
 
-    def provider_friendly_name
+    def self.provider_friendly_name
       "oVirt"
     end
 
diff --git a/app/models/compute_resources/foreman/model/rackspace.rb b/app/models/compute_resources/foreman/model/rackspace.rb
index 199b8f21c..70e842d82 100644
--- a/app/models/compute_resources/foreman/model/rackspace.rb
+++ b/app/models/compute_resources/foreman/model/rackspace.rb
@@ -77,7 +77,7 @@ module Foreman::Model
       false
     end
 
-    def provider_friendly_name
+    def self.provider_friendly_name
       "Rackspace"
     end
 
diff --git a/app/models/compute_resources/foreman/model/vmware.rb b/app/models/compute_resources/foreman/model/vmware.rb
index 433d7cc1c..af0d26ad9 100644
--- a/app/models/compute_resources/foreman/model/vmware.rb
+++ b/app/models/compute_resources/foreman/model/vmware.rb
@@ -349,7 +349,7 @@ module Foreman::Model
       Host.authorized(:view_hosts, Host).where(:mac => vm.mac).first
     end
 
-    def provider_friendly_name
+    def self.provider_friendly_name
       "VMWare"
     end
 
diff --git a/app/views/about/index.html.erb b/app/views/about/index.html.erb
index 06aeb6637..370726901 100644
--- a/app/views/about/index.html.erb
+++ b/app/views/about/index.html.erb
@@ -43,7 +43,7 @@
               </tr>
               <% ComputeResource.supported_providers.each do |provider,klass| %>
                 <tr>
-                  <td><%= provider %></td>
+                  <td><%= klass.constantize.provider_friendly_name %></td>
                   <% if ComputeResource.providers.include?(provider) %>
                     <td><div class="label label-success"><%= _('Installed') %></div></td>
                   <% else %>
diff --git a/app/views/compute_resources/_form.html.erb b/app/views/compute_resources/_form.html.erb
index 369b1328e..a3c716d9a 100644
--- a/app/views/compute_resources/_form.html.erb
+++ b/app/views/compute_resources/_form.html.erb
@@ -18,7 +18,7 @@
   <% end %>
         <%= text_f f, :name %>
         <%= f.hidden_field(:provider, :id => '') if f.object.uuid.present? %>
-        <%= selectable_f f, :provider, ComputeResource.providers, { :include_blank => _("Choose a provider")},
+        <%= selectable_f f, :provider, list_providers, { :include_blank => _("Choose a provider")},
                          {:label => _("Provider"), :disabled=> f.object.uuid.present?, :'data-url'=> provider_selected_compute_resources_path, :onchange => 'providerSelected(this);'} %>
         <%= textarea_f f, :description, :rows => 3 %>
         <div id='compute_connection'>
diff --git a/app/views/compute_resources/show.html.erb b/app/views/compute_resources/show.html.erb
index 580f6fa8d..bddecfe91 100644
--- a/app/views/compute_resources/show.html.erb
+++ b/app/views/compute_resources/show.html.erb
@@ -24,7 +24,7 @@
 
       <tr>
         <td><%= _("Provider") %></td>
-        <td><%= @compute_resource.provider %></td>
+        <td><%= @compute_resource.provider_friendly_name %></td>
       </tr>
 
       <% unless @compute_resource.description.empty? %>
