Module: PuppetRepl::Support::Environment

Included in:
PuppetRepl::Support
Defined in:
lib/puppet-repl/support/environment.rb

Instance Method Summary collapse

Instance Method Details

#create_environmentObject



10
11
12
13
14
15
16
# File 'lib/puppet-repl/support/environment.rb', line 10

def create_environment
  @puppet_environment = Puppet::Node::Environment.create(
    default_puppet_env_name,
    default_modules_paths,
    default_manifests_dir
  )
end

#default_puppet_env_nameObject

the cached name of the environment



27
28
29
# File 'lib/puppet-repl/support/environment.rb', line 27

def default_puppet_env_name
   ENV['PUPPET_ENV'] || Puppet[:environment]
end

#environment_loadersObject

currently this is not being used



32
33
34
# File 'lib/puppet-repl/support/environment.rb', line 32

def environment_loaders
  name = compiler.loaders.public_environment_loader.loader_name
end

#puppet_env_nameObject



22
23
24
# File 'lib/puppet-repl/support/environment.rb', line 22

def puppet_env_name
  puppet_environment.name
end

#puppet_environmentObject

creates a puppet environment given a module path and environment name this is cached



6
7
8
# File 'lib/puppet-repl/support/environment.rb', line 6

def puppet_environment
  @puppet_environment ||= create_environment
end

#set_environment(value) ⇒ Object



18
19
20
# File 'lib/puppet-repl/support/environment.rb', line 18

def set_environment(value)
  @puppet_environment = value
end