Class: Puppet::InfoService::ClassInformationService Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/info_service/class_information_service.rb

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.

Instance Method Summary collapse

Constructor Details

#initializeClassInformationService

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


7
8
9
10
# File 'lib/puppet/info_service/class_information_service.rb', line 7

def initialize
  @file_to_result = {}
  @parser = Puppet::Pops::Parser::EvaluatingParser.new()
end

Instance Method Details

#classes_per_environment(env_file_hash) ⇒ Object

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.


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/puppet/info_service/class_information_service.rb', line 12

def classes_per_environment(env_file_hash)
  # In this version of puppet there is only one way to parse manifests, as feature switches per environment
  # are added or removed, this logic needs to change to compute the result per environment with the correct
  # feature flags in effect.

  unless env_file_hash.is_a?(Hash)
    raise ArgumentError, _('Given argument must be a Hash')
  end

  result = {}

  # for each environment
  #   for each file
  #     if file already processed, use last result or error
  #
  env_file_hash.each do |env, files|
    env_result = result[env] = {}
    files.each do |f|
      env_result[f] = result_of(f)
    end
  end
  result
end