Sha256: ac541bf3518a5c8a7300168f69024f7fc4c1fe691edeb17a6da778a7d580625f

Contents?: true

Size: 922 Bytes

Versions: 9

Compression:

Stored size: 922 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
        @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

9 entries across 9 versions & 1 rubygems

Version Path
puppet-repl-0.3.4 lib/puppet-repl/support/environment.rb
puppet-repl-0.3.3 lib/puppet-repl/support/environment.rb
puppet-repl-0.3.2 lib/puppet-repl/support/environment.rb
puppet-repl-0.3.1 lib/puppet-repl/support/environment.rb
puppet-repl-0.3.0 lib/puppet-repl/support/environment.rb
puppet-repl-0.2.3 lib/puppet-repl/support/environment.rb
puppet-repl-0.2.2 lib/puppet-repl/support/environment.rb
puppet-repl-0.2.1 lib/puppet-repl/support/environment.rb
puppet-repl-0.2.0 lib/puppet-repl/support/environment.rb