Class: Puppet::Environments::Legacy Private

Inherits:
Object
  • Object
show all
Includes:
EnvironmentCreator
Defined in:
lib/puppet/environments.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Old-style environments that come either from explicit stanzas in puppet.conf or from dynamic environments created from use of ‘$environment` in puppet.conf.

Examples:

Explicit Stanza

[environment_name]
modulepath=/var/my_env/modules

Dynamic Environments

[master]
modulepath=/var/$environment/modules

Instance Method Summary collapse

Methods included from EnvironmentCreator

#for

Instance Method Details

#get(name) ⇒ Puppet::Node::Environment?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

Because the Legacy system cannot list out all of its environments, get is able to return environments that are not returned by a call to #list.

Find a named environment

Parameters:

Returns:



167
168
169
# File 'lib/puppet/environments.rb', line 167

def get(name)
  Puppet::Node::Environment.new(name)
end

#get!(name) ⇒ Puppet::Node::Environment

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

Because the Legacy system cannot list out all of its environments, this method will never fail and is only calling get directly.

Find a named environment or raise Puppet::Environments::EnvironmentNotFound when the named environment is does not exist.

Parameters:

Returns:



175
176
177
# File 'lib/puppet/environments.rb', line 175

def get!(name)
  get(name)
end

#get_conf(name) ⇒ Puppet::Setting::EnvironmentConf?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

we could return something here, but since legacy environments are deprecated, there is no point.

Attempt to obtain the initial configuration for the environment. Not all loaders can provide this.

Parameters:

  • name (String, Symbol)

    The name of the environment whose configuration we are looking up

Returns:

  • (Puppet::Setting::EnvironmentConf, nil)

    the configuration for the requested environment, or nil if not found or no configuration is available



183
184
185
# File 'lib/puppet/environments.rb', line 183

def get_conf(name)
  nil
end

#listArray<Puppet::Node::Environment>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

The list of environments for the Legacy environments is always empty.

Returns All of the environments known to the loader.

Returns:



158
159
160
# File 'lib/puppet/environments.rb', line 158

def list
  []
end

#search_pathsArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A list of indicators of where the loader is getting its environments from.

Returns:



150
151
152
# File 'lib/puppet/environments.rb', line 150

def search_paths
  ["file://#{Puppet[:config]}"]
end