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-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.7 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.7-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.7-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.6 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.6-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.6-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.5 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.5-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.5-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.4 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.4-x86-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-3.8.4-x64-mingw32 lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/indirector/catalog/active_record.rb