Class: Setting::DefaultHostgroup

Inherits:
Setting
  • Object
show all
Defined in:
app/models/setting/default_hostgroup.rb

Class Method Summary collapse

Class Method Details

.load_defaultsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/models/setting/default_hostgroup.rb', line 4

def self.load_defaults
  # Check the table exists
  return unless ActiveRecord::Base.connection.table_exists?('settings')
  return unless super

  Setting.transaction do
    [
      set('force_hostgroup_match', 'Apply hostgroup matching even if a host already has one.', false),
      set('force_hostgroup_match_only_new', 'Apply hostgroup matching only on new hosts', true),
      set('force_host_environment', "Apply hostgroup's environment to host even if a host already has a different one", true)
    ].compact.each { |s| create s.update(category: 'Setting::DefaultHostgroup') }
  end

  true
end