Sha256: f53603c380b178eb133bf419977f0c30085aed75a61330436cb6206350edb345

Contents?: true

Size: 1.33 KB

Versions: 22

Compression:

Stored size: 1.33 KB

Contents

#
# Simple module for logging messages on the client-side
#

module Puppet
  newtype(:r8_export_file) do
    @doc = "r8 export file content"

    newparam(:name) do
      desc "component and attribute name in dot notation"
    end

    newparam(:filename) do
      desc "file name"
    end

    newparam(:definition_key) do
      desc "Value of name field used when teher is a definition"
    end

    newproperty(:ensure) do
      desc "Whether the resource is in sync or not."

      defaultto :insync

      def retrieve
        :outofsync
      end

      newvalue :insync do
        filename = resource[:filename]
        unless File.exists?(filename)
          raise Puppet::Error, "File #{resource[:filename]} does not exist"
        end
        Puppet.send(@resource[:loglevel], "exporting #{filename} for #{resource[:name]}")
        if resource[:name] =~ /(^.+)\.(.+$)/
          cmp_name = $1
          attr_name = $2
          
          cmp_ref = cmp_name.gsub(/[.]/,"::")
          if def_key =  resource[:definition_key]
            cmp_ref = "#{cmp_ref}[#{def_key}]"
          end
          p = (Thread.current[:exported_files] ||= Hash.new)[cmp_ref] ||= Hash.new
          p[attr_name] = filename
        else
          raise Puppet::Error, "ill-formed component with name (#{resource[:name]})"
        end
        return
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
dtk-node-agent-0.7.6 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.5 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.4.1 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.4 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.3 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.2 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.1 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.7.0 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.7 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.6 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.4 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.3 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.2 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.1 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.6.0 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.5.17 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.5.16 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.5.15 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.5.14 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
dtk-node-agent-0.5.13 puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb