Class: DhcpController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DhcpController
- Defined in:
- app/controllers/dhcp_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/dhcp_controller.rb', line 14 def create @record = Net::DHCP::Record.new(params[:net_dhcp_record]) if @record.create process_success(success_redirect: subnet_dhcp_index_path(@subnet), object_name: @record.to_s) else process_error(redirect: subnet_dhcp_index_path(@subnet)) end rescue ProxyAPI::ProxyException => e error_msg = (e.try(:wrapped_exception).try(:response) || e).to_s process_error error_msg: error_msg end |
#destroy ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/controllers/dhcp_controller.rb', line 34 def destroy if @record.destroy process_success(success_redirect: subnet_dhcp_index_path(@subnet), object_name: @record.to_s) else process_error(redirect: subnet_dhcp_index_path(@subnet)) end end |
#edit ⇒ Object
28 |
# File 'app/controllers/dhcp_controller.rb', line 28 def edit; end |
#index ⇒ Object
5 |
# File 'app/controllers/dhcp_controller.rb', line 5 def index; end |
#new ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/dhcp_controller.rb', line 7 def new # HACK: hack hack, need to fix foreman core to validate on create/save instead of init @record = Net::DHCP::Record.new proxy: @subnet.dhcp_proxy, hostname: 'dummy', mac: 'aa:bb:cc:dd:ee:ff', network: @subnet.network, ip: '1.2.3.4' @record.hostname = @record.mac = @record.ip = nil end |
#show ⇒ Object
26 |
# File 'app/controllers/dhcp_controller.rb', line 26 def show; end |
#update ⇒ Object
30 31 32 |
# File 'app/controllers/dhcp_controller.rb', line 30 def update # TODO end |