Class: Puppet::Environments::Combined Private

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

Combine together multiple loaders to act as one.

Instance Method Summary collapse

Methods included from EnvironmentLoader

#get!, #guard, #unguard

Constructor Details

#initialize(*loaders) ⇒ Combined

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 Combined.


272
273
274
# File 'lib/puppet/environments.rb', line 272

def initialize(*loaders)
  @loaders = loaders
end

Instance Method Details

#clear_allObject

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.


308
309
310
# File 'lib/puppet/environments.rb', line 308

def clear_all
  @loaders.each {|loader| loader.clear_all}
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.

Find a named environment

Parameters:

  • name (String, Symbol)

    The name of environment to find

Returns:


287
288
289
290
291
292
293
294
295
# File 'lib/puppet/environments.rb', line 287

def get(name)
  @loaders.each do |loader|
    env = loader.get(name)
    if env
      return env
    end
  end
  nil
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.

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


298
299
300
301
302
303
304
305
306
# File 'lib/puppet/environments.rb', line 298

def get_conf(name)
  @loaders.each do |loader|
    conf = loader.get_conf(name)
    if conf
      return conf
    end
  end
  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.

Returns All of the environments known to the loader.

Returns:


282
283
284
# File 'lib/puppet/environments.rb', line 282

def list
  @loaders.collect(&:list).flatten
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:

  • (Array<String>)

    The URIs of the load locations


277
278
279
# File 'lib/puppet/environments.rb', line 277

def search_paths
  @loaders.collect(&:search_paths).flatten
end