Sha256: 774b7a18abb46fa929b39e7333cec5561eb2707d495ad55aeb9cf38e3ab22baf

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

module PuppetDebugger
  module Support
    module Environment
      # creates a puppet environment given a module path and environment name
      # this is cached
      def puppet_environment
        @puppet_environment ||= create_environment
      end

      def create_environment
        @puppet_environment = Puppet::Node::Environment.create(
          default_puppet_env_name,
          default_modules_paths,
          default_manifests_dir
        )
      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-debugger-0.4.1 lib/puppet-debugger/support/environment.rb
puppet-debugger-0.4.0 lib/puppet-debugger/support/environment.rb