Sha256: acd10a05347b7a982d5c6f5c75a7cc59342a64881b5e375df75137b0ea94176b

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

module PuppetRepl
  module Support
    module Environment
      # creates a puppet environment given a module path and environment name
      # this is cached
      def puppet_environment
        unless @puppet_environment
          do_initialize
          @puppet_environment = Puppet::Node::Environment.create(
          default_puppet_env_name,
          default_modules_paths,
          default_manifests_dir
          )
        end
        @puppet_environment
      end

      def set_environment(value)
        @puppet_environment = value
      end

      def puppet_env_name
        puppet_environment.name
      end

      # the cached name of the environment
      def default_puppet_env_name
         ENV['PUPPET_ENV'] || Puppet[:environment]
      end

      # currently this is not being used
      def environment_loaders
        name = compiler.loaders.public_environment_loader.loader_name
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-repl-0.1.1 lib/puppet-repl/support/environment.rb
puppet-repl-0.1.0 lib/puppet-repl/support/environment.rb