Class: ForemanOpenscap::HostgroupOverrider

Inherits:
Object
  • Object
show all
Includes:
HostgroupOverriderCommon
Defined in:
app/services/foreman_openscap/hostgroup_overrider.rb

Instance Method Summary collapse

Methods included from HostgroupOverriderCommon

#add_overrides, #remove_overrides

Constructor Details

#initialize(policy) ⇒ HostgroupOverrider

Returns a new instance of HostgroupOverrider.



5
6
7
8
# File 'app/services/foreman_openscap/hostgroup_overrider.rb', line 5

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

Instance Method Details

#populateObject



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

def populate
  return unless @policy.deploy_by && Policy.deploy_by_variants.include?(@policy.deploy_by)
  config = @name_sevice.config_for @policy.deploy_by.to_sym
  return unless config.available?
  return unless config.managed_overrides?
  @policy.hostgroups.each do |hostgroup|
    populate_overrides hostgroup, config
  end
end