Method: Puppet::Application.environment_mode

Defined in:
lib/puppet/application.rb

.environment_mode(mode_name) ⇒ Object

Sets environment_mode name. When acting as a compiler, the environment mode should be ‘:local` since the directory must exist to compile the catalog. When acting as an agent, the environment mode should be `:remote` since the Puppet setting refers to an environment directoy on a remote system. The `:not_required` mode is for cases where the application does not need an environment to run.

Parameters:

  • mode_name (Symbol)

    The name of the environment mode to run in. May be one of ‘:local`, `:remote`, or `:not_required`. This impacts where the application looks for its specified environment. If `:not_required` or `:remote` are set, the application will not fail if the environment does not exist on the local filesystem.

Raises:



304
305
306
307
# File 'lib/puppet/application.rb', line 304

def environment_mode(mode_name)
  raise Puppet::Error, _("Invalid environment mode '%{mode_name}'") % { mode_name: mode_name } unless [:local, :remote, :not_required].include?(mode_name)
  @environment_mode = mode_name
end