Class: Puppet::Environments::Static Private

Inherits:
Object
  • Object
show all
Includes:
EnvironmentCreator, EnvironmentLoader
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.

A source of pre-defined environments.

API:

  • private

Direct Known Subclasses

StaticPrivate

Instance Method Summary collapse

Methods included from EnvironmentLoader

#clear_all, #get!

Methods included from EnvironmentCreator

#for

Constructor Details

#initialize(*environments) ⇒ Static

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.

Returns a new instance of Static.

API:

  • private



87
88
89
# File 'lib/puppet/environments.rb', line 87

def initialize(*environments)
  @environments = environments
end

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.

Find a named environment

Parameters:

  • The name of environment to find

Returns:

  • the requested environment or nil if it wasn’t found

API:

  • private



102
103
104
105
106
# File 'lib/puppet/environments.rb', line 102

def get(name)
  @environments.find do |env|
    env.name == name.intern
  end
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.

Returns a basic environment configuration object tied to the environment’s implementation values. Will not interpolate.

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

Parameters:

  • The name of the environment whose configuration we are looking up

Returns:

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

API:

  • private



112
113
114
115
116
117
118
119
# File 'lib/puppet/environments.rb', line 112

def get_conf(name)
  env = get(name)
  if env
    Puppet::Settings::EnvironmentConf.static_for(env, 0, Puppet[:static_catalogs])
  else
    nil
  end
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.

Returns All of the environments known to the loader.

Returns:

  • All of the environments known to the loader

API:

  • private



97
98
99
# File 'lib/puppet/environments.rb', line 97

def list
  @environments
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:

  • The URIs of the load locations

API:

  • private



92
93
94
# File 'lib/puppet/environments.rb', line 92

def search_paths
  ["data:text/plain,internal"]
end