Method: Puppet::Node#environment

Defined in:
lib/puppet/node.rb

#environmentObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/puppet/node.rb', line 60

def environment
  if @environment
    @environment
  else
    env = parameters[ENVIRONMENT]
    if env
      self.environment = env
    elsif environment_name
      self.environment = environment_name
    else
      # This should not be :current_environment, this is the default
      # for a node when it has not specified its environment
      # it will be used to establish what the current environment is.
      #
      self.environment = Puppet.lookup(:environments).get!(Puppet[:environment])
    end

    @environment
  end
end