Sha256: e61b4330665504e6c437ec075bc7b65c779a1ca91521b9232e9673f3e37d7750

Contents?: true

Size: 987 Bytes

Versions: 14

Compression:

Stored size: 987 Bytes

Contents

require 'puppet'

module MCollective
  module Util
    class PuppetRunner

      def self.apply(puppet_definition, resource_hash)
        Puppet.settings.initialize_global_settings
        Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(Puppet.run_mode))

        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

14 entries across 14 versions & 1 rubygems

Version Path
dtk-node-agent-0.7.0 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.7 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.6 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.4 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.3 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.2 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.1 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.6.0 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.5.17 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.5.16 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.5.15 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.5.14 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.5.13 mcollective_additions/plugins/v2.2/util/puppetrunner.rb
dtk-node-agent-0.5.12 mcollective_additions/plugins/v2.2/util/puppetrunner.rb