Sha256: 9ebc039df707794d4eb04ded1859a759e2f3d15e3491ea4749e7650e6ab4f00f

Contents?: true

Size: 791 Bytes

Versions: 7

Compression:

Stored size: 791 Bytes

Contents

class Setting::Discovered < ::Setting
  BLANK_ATTRS << "discovery_location"
  BLANK_ATTRS << "discovery_organization"

  def self.load_defaults
    # Check the table exists
    return unless super

    if SETTINGS[:locations_enabled]
      Setting.transaction do
        [
          self.set('discovery_location', "The default Location to place Discovered Hosts in", ""),
        ].compact.each { |s| self.create s.update(:category => "Setting::Discovered")}
      end
    end
    if SETTINGS[:organizations_enabled]
      Setting.transaction do
        [
          self.set('discovery_organization', "The default Organization to place Discovered Hosts in", "" ),
        ].compact.each { |s| self.create s.update(:category => "Setting::Discovered")}
      end
    end

    true

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_discovery-1.1.1 app/models/setting/discovered.rb
foreman_discovery-1.0.2 app/models/setting/discovered.rb
foreman_discovery-1.0.0 app/models/setting/discovered.rb
foreman_discovery-1.0.0.rc4 app/models/setting/discovered.rb
foreman_discovery-1.0.0.rc3 app/models/setting/discovered.rb
foreman_discovery-1.0.0.rc2 app/models/setting/discovered.rb
foreman_discovery-1.0.0.rc1 app/models/setting/discovered.rb