Class: ForemanOrchestration::StackTemplatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_orchestration/stack_templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

TODO: there is an API for template validation: developer.openstack.org/api-ref-orchestration-v1.html#template_validate Maybe we can use it here?



16
17
18
19
20
21
22
23
# File 'app/controllers/foreman_orchestration/stack_templates_controller.rb', line 16

def create
  @template = StackTemplate.new(template_params)
  if @template.save
    process_success object: @template
  else
    process_error object: @template
  end
end

#destroyObject



33
34
35
36
37
38
39
# File 'app/controllers/foreman_orchestration/stack_templates_controller.rb', line 33

def destroy
  if @template.destroy
    process_success object: @template
  else
    process_error object: @template
  end
end

#indexObject



5
6
7
# File 'app/controllers/foreman_orchestration/stack_templates_controller.rb', line 5

def index
  @templates = StackTemplate.order(:name).all
end

#newObject



9
10
11
# File 'app/controllers/foreman_orchestration/stack_templates_controller.rb', line 9

def new
  @template = StackTemplate.new
end

#updateObject



25
26
27
28
29
30
31
# File 'app/controllers/foreman_orchestration/stack_templates_controller.rb', line 25

def update
  if @template.update_attributes(template_params)
    process_success object: @template
  else
    process_error object: @template
  end
end

#with_paramsObject

ajax methods



42
43
44
# File 'app/controllers/foreman_orchestration/stack_templates_controller.rb', line 42

def with_params
  render partial: 'with_params', locals: {template: @template, parameters: {}}
end