Class: ForemanXen::CacheController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_xen/cache_controller.rb

Instance Method Summary collapse

Instance Method Details

#refreshObject

POST = foreman_xen/cache/refresh



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/foreman_xen/cache_controller.rb', line 6

def refresh
  type = params[:type]

  unless cache_attribute_whitelist.include?(type)
    process_error(:error_msg => "Error refreshing cache. #{type} is not a white listed attribute")
  end

  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 { render :json => @compute_resource.public_send("#{type}!") }
  end
end