Class: ForemanOpenscap::LookupKeyOverrider

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_openscap/lookup_key_overrider.rb

Instance Method Summary collapse

Constructor Details

#initialize(policy) ⇒ LookupKeyOverrider

Returns a new instance of LookupKeyOverrider.



3
4
5
6
# File 'app/services/foreman_openscap/lookup_key_overrider.rb', line 3

def initialize(policy)
  @policy = policy
  @name_service = ConfigNameService.new
end

Instance Method Details

#overrideObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/foreman_openscap/lookup_key_overrider.rb', line 8

def override
  return unless @policy.deploy_by && Policy.deploy_by_variants.include?(@policy.deploy_by)
  config = @name_service.config_for @policy.deploy_by.to_sym
  unless config.available?
    @policy.errors[:deploy_by] <<
      _("%{type} was selected to deploy policy to clients, but %{type} is not available. Are you missing a plugin?") %
      { :type => config.type.to_s.camelize }
    return
  end
  return unless config.managed_overrides?
  override_required_params config
end