Method: Puppet::Node#environment=

Defined in:
lib/puppet/node.rb

#environment=(env) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/puppet/node.rb', line 81

def environment=(env)
  if env.is_a?(String) or env.is_a?(Symbol)
    @environment = Puppet.lookup(:environments).get!(env)
  else
    @environment = env
  end

  # Keep environment_name attribute and parameter in sync if they have been set
  unless @environment.nil?
    # always set the environment parameter. It becomes top scope $environment for a manifest during catalog compilation.
    @parameters[ENVIRONMENT] = @environment.name.to_s
    self.environment_name = @environment.name
  end
end