Module: ForemanOpenscap::HostsControllerExtensions
- Defined in:
- app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
- #process_hostgroup ⇒ Object
- #select_multiple_openscap_proxy ⇒ Object
- #update_multiple_openscap_proxy ⇒ Object
Class Method Details
.prepended(base) ⇒ Object
3 4 5 |
# File 'app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb', line 3 def self.prepended(base) base::AJAX_REQUESTS << 'openscap_proxy_changed' end |
Instance Method Details
#process_hostgroup ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb', line 7 def process_hostgroup @hostgroup = ::Hostgroup.find(params[:host][:hostgroup_id]) if params[:host][:hostgroup_id].to_i > 0 return head(:not_found) unless @hostgroup @openscap_proxy = @hostgroup.openscap_proxy super end |
#select_multiple_openscap_proxy ⇒ Object
14 15 16 |
# File 'app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb', line 14 def select_multiple_openscap_proxy find_multiple end |
#update_multiple_openscap_proxy ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb', line 18 def update_multiple_openscap_proxy if (id = params['smart_proxy']['id']) find_multiple smart_proxy = ::SmartProxy.find(id) @hosts.each do |host| host.openscap_proxy = smart_proxy host.save! end success _("Updated hosts: Assigned with OpenSCAP Proxy: %s") % smart_proxy.name redirect_to hosts_path else error _('No OpenSCAP Proxy selected.') redirect_to(select_multiple_openscap_proxy_hosts_path) end end |