Sha256: c8cbe53a0bd0788c807cccf7d58454aadba79f76ae4a4ad90715d142b51a0d9c

Contents?: true

Size: 1.19 KB

Versions: 96

Compression:

Stored size: 1.19 KB

Contents

require 'puppet/rails/host'
require 'puppet/indirector/active_record'
require 'puppet/resource/catalog'

class Puppet::Resource::Catalog::ActiveRecord < Puppet::Indirector::ActiveRecord
  use_ar_model Puppet::Rails::Host

  desc "A component of ActiveRecord storeconfigs. ActiveRecord-based storeconfigs
    and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"

  def initialize
    Puppet.deprecation_warning "ActiveRecord-based storeconfigs and inventory are deprecated. See http://links.puppetlabs.com/activerecord-deprecation"
    super
  end

  # We don't retrieve catalogs from storeconfigs
  def find(request)
    nil
  end

  # Save the values from a Facts instance as the facts on a Rails Host instance.
  def save(request)
    catalog = request.instance

    host = ar_model.find_by_name(catalog.name) || ar_model.create(:name => catalog.name)

    host.railsmark "Saved catalog to database" do
      host.merge_resources(catalog.vertices)
      host.last_compile = Time.now

      if node = Puppet::Node.indirection.find(catalog.name)
        host.ip = node.parameters["ipaddress"]
        host.environment = node.environment.to_s
      end

      host.save
    end
  end
end

Version data entries

96 entries across 96 versions & 3 rubygems

Version Path
puppet-3.7.3-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.2 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.2-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.2-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.1 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.1-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.1-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.0 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.0-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.7.0-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.2 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.2-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.1 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.1-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.0 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.0-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.0.rc1 lib/puppet/indirector/catalog/active_record.rb
puppet-3.6.0.rc1-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.5.1 lib/puppet/indirector/catalog/active_record.rb
puppet-3.5.1-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb