Module: ForemanOpenscap::HostsAndHostgroupsControllerExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb
Instance Method Summary collapse
- #detect_proxy_without_scap ⇒ Object
- #openscap_proxy_id ⇒ Object
- #scap_enabled_proxy?(proxy_id) ⇒ Boolean
Instance Method Details
#detect_proxy_without_scap ⇒ Object
8 9 10 11 12 13 |
# File 'app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb', line 8 def detect_proxy_without_scap unless openscap_proxy_id.nil? error = _("The %s proxy does not have Openscap feature enabled. Either set correct OpenSCAP Proxy or unset it.") % openscap_proxy_id[:name] return error(error, :now => true) unless scap_enabled_proxy?(openscap_proxy_id) end end |
#openscap_proxy_id ⇒ Object
19 20 21 |
# File 'app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb', line 19 def openscap_proxy_id @host.try(:openscap_proxy) || @hostgroup.try(:openscap_proxy) end |
#scap_enabled_proxy?(proxy_id) ⇒ Boolean
15 16 17 |
# File 'app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb', line 15 def scap_enabled_proxy?(proxy_id) SmartProxy.find_by!(id: proxy_id).feature_names.include?('Openscap') end |