Sha256: fadb9bef0dcd19a01d9f6190c0242f06bc998061c166c7af04d2a40b396e7ccd

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 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"), "discovery_bootif"),
      ].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

9 entries across 9 versions & 1 rubygems

Version Path
foreman_discovery-1.4.1 app/models/setting/discovered.rb
foreman_discovery-1.4.0 app/models/setting/discovered.rb
foreman_discovery-1.4.0.rc4 app/models/setting/discovered.rb
foreman_discovery-1.4.0.rc3 app/models/setting/discovered.rb
foreman_discovery-1.4.0.rc2 app/models/setting/discovered.rb
foreman_discovery-1.4.0.rc1 app/models/setting/discovered.rb
foreman_discovery-1.3.0 app/models/setting/discovered.rb
foreman_discovery-1.3.0.rc3 app/models/setting/discovered.rb
foreman_discovery-1.3.0.rc2 app/models/setting/discovered.rb