Class: ForemanXen::CacheController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanXen::CacheController
- Defined in:
- app/controllers/foreman_xen/cache_controller.rb
Instance Method Summary collapse
-
#refresh ⇒ Object
POST = foreman_xen/cache/refresh.
Instance Method Details
#refresh ⇒ Object
POST = foreman_xen/cache/refresh
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/foreman_xen/cache_controller.rb', line 6 def refresh type = params[:type] process_error(:error_msg => "Error refreshing cache. #{type} is not a white listed attribute") unless cache_attribute_whitelist.include?(type) unless @compute_resource.respond_to?("#{type}!") process_error(:error_msg => "Error refreshing cache. Method '#{type}!' not found for compute resource" + @compute_resource.name) end respond_to do |format| format.json do filtered_data = @compute_resource.public_send("#{type}!").map do |e| e.attributes.slice(:id, :uuid, :name, :display_name) end render json: filtered_data end end end |