Class: ForemanDatacenter::InterfaceTemplatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_datacenter/interface_templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 21

def create
  @interface_template = InterfaceTemplate.new(interface_template_params)

  if @interface_template.save
    redirect_to device_type_url(@interface_template.device_type),
                notice: 'New interface template was successfully created'
  else
    process_error object: @interface_template
  end
end

#destroyObject



32
33
34
35
36
37
38
39
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 32

def destroy
  if @interface_template.destroy
    redirect_to device_type_url(@interface_template.device_type),
                notice: 'Interface template was successfully destroyed'
  else
    process_error object: @interface_template
  end
end

#newObject



5
6
7
8
9
10
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 5

def new
  @interface_template = InterfaceTemplate.new(
    device_type: DeviceType.find(params[:device_type_id]),
    form_factor: '10GE (SFP+)'
  )
end

#new_managementObject



12
13
14
15
16
17
18
19
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 12

def new_management
  @interface_template = InterfaceTemplate.new(
    device_type: DeviceType.find(params[:device_type_id]),
    form_factor: '10GE (SFP+)',
    mgmt_only: true
  )
  render :new
end