Sha256: a7992ed752d6d14d0abd0bcd82189a4972e9ce0be6f102de2a6f18aeb886ed06

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

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

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

    Setting.transaction do
      [
        self.set('discovery_fact', _("The default fact name to use for the MAC of the system"), "macaddress"),
      ].compact.each { |s| self.create s.update(:category => "Setting::Discovered")}
    end

    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

4 entries across 4 versions & 1 rubygems

Version Path
foreman_discovery-1.3.0.rc1 app/models/setting/discovered.rb
foreman_discovery-1.2.0 app/models/setting/discovered.rb
foreman_discovery-1.2.0.rc2 app/models/setting/discovered.rb
foreman_discovery-1.2.0.rc1 app/models/setting/discovered.rb