Sha256: 00b26890a8f531c76cc1c0e822a0c3bbf5cb5fd119dffd95b79c40efce2dc800

Contents?: true

Size: 1.41 KB

Versions: 42

Compression:

Stored size: 1.41 KB

Contents

require 'puppet/indirector/r8_storeconfig_backend'
require 'puppet/resource/catalog'

class Puppet::Resource::Catalog::R8StoreconfigBackend < Puppet::Indirector::R8StoreconfigBackend
  def find(request)
    require 'pp'
    pp [:in_find]
    nil
  end

  # Save the values from a Facts instance as the facts on a Rails Host instance.
  def save(request)
    require 'pp'
    if catalog = request.instance
      catalog.vertices.each  do |r|
        if r.exported?
          #TODO: think the following is ways to get the higher level component
          component = calling_class_or_def_name(catalog,r)
          rsc_title = r.title
          content = r.to_pson_data_hash
          pp([
              :calling_save,
              {:resource_title => rsc_title, 
                :component => component,
                :content => content
              }])
          p = Thread.current[:exported_resources] ||= Hash.new
          (p[component] ||= Hash.new)[rsc_title] = content 
        end
      end
    end
    catalog
  end

  def calling_class_or_def_name(catalog,resource)
    adjs = catalog.adjacent(resource,:direction => :in)
    unless adjs.size == 1
      raise Puppet::Error, "Unexpected size of adjaceny"
    end
    containing_rsc = adjs.first
    #TODO: make sure works with qualified names
    if containing_rsc.type == "Class"
      containing_rsc.title.downcase
    else
      containing_rsc.type.downcase
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
dtk-node-agent-0.12.2 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.12.1 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.12.0 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.11.4 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.11.3 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.11.2 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.11.1 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.11.0 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.7 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.6 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.5 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.4 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.3 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.2 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.1 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.10.0 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.9.1 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.9.0 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.8.0 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb
dtk-node-agent-0.7.7 puppet_additions/puppet_lib_base/puppet/indirector/catalog/r8_storeconfig_backend.rb