Class: ForemanOrchestration::StacksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanOrchestration::StacksController
- Defined in:
- app/controllers/foreman_orchestration/stacks_controller.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/controllers/foreman_orchestration/stacks_controller.rb', line 5 def all @compute_resource = find_default_compute_resource if @compute_resource @tenants = @compute_resource.orchestration_clients @tenant = @compute_resource.default_tenant @stacks = @tenant.stacks if @tenant end end |
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/foreman_orchestration/stacks_controller.rb', line 25 def create @stack = Stack.new(create_stack_params) if @stack.save flash[:notice] = "Stack '#{@stack.name}' is being created now" redirect_to all_stacks_path else load_compute_resources process_error object: @stack end end |
#destroy ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/foreman_orchestration/stacks_controller.rb', line 36 def destroy @stack = Stack.new(compute_resource_id: params[:compute_resource_id], tenant_id: params[:tenant_id], id: params[:id]) @stack.destroy redirect_to all_stacks_path, notice: 'Stack is being deleted now' end |
#index ⇒ Object
14 15 16 17 18 19 |
# File 'app/controllers/foreman_orchestration/stacks_controller.rb', line 14 def index @compute_resource = find_compute_resource @tenant = @compute_resource.orchestration_client_for(params[:tenant_id]) @stacks = @tenant.stacks render layout: !ajax? end |
#new ⇒ Object
21 22 23 |
# File 'app/controllers/foreman_orchestration/stacks_controller.rb', line 21 def new @stack = Stack.new(new_stack_params) end |