Sha256: bea77edd47af086c5618cdedf6a8ed3c29c3a25de44859166d56373451b6489e

Contents?: true

Size: 954 Bytes

Versions: 3

Compression:

Stored size: 954 Bytes

Contents

# frozen_string_literal: true
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

3 entries across 3 versions & 1 rubygems

Version Path
puppet-debugger-0.4.4 lib/puppet-debugger/support/environment.rb
puppet-debugger-0.4.3 lib/puppet-debugger/support/environment.rb
puppet-debugger-0.4.2 lib/puppet-debugger/support/environment.rb