Sha256: f5184b8effb6cf8c4464122cd6ae08f6f9f735d9efaa5b0c55b016a1a6510220

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

require 'puppet'

module MCollective
  module Util
    class PuppetRunner

      def self.apply(puppet_definition, resource_hash)
        if Puppet.settings.respond_to?(:initialize_global_settings)
          Puppet.settings.initialize_global_settings
        end

        if Puppet.settings.respond_to?(:initialize_app_defaults)
          Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(Puppet.run_mode))
        end

        Log.info("Puppet Runner, INPUT :")
        Log.info(puppet_definition)
        Log.info(resource_hash.inspect)
        Log.info("########################################################################")

        pup = Puppet::Type.type(puppet_definition).new(resource_hash)
        catalog = Puppet::Resource::Catalog.new
        catalog.add_resource pup
        catalog.apply()

        Log.info("Puppet Runner, OUTPUT: ")
        Log.info(Thread.current[:report_status])
        Log.info(Thread.current[:report_info])
        Log.info("########################################################################")
        true
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dtk-node-agent-0.7.7 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.6 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.5 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.4.1 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.4 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.3 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.2 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.7.1 mcollective_additions/plugins/v2.2/util/puppetrunner.rb