class Puppet::InfoService::PlanInformationService

Public Class Methods

plan_data(environment_name, module_name, plan_name) click to toggle source
   # File lib/puppet/info_service/plan_information_service.rb
15 def self.plan_data(environment_name, module_name, plan_name)
16   # raise EnvironmentNotFound if applicable
17   Puppet.lookup(:environments).get!(environment_name)
18 
19   pup_module = Puppet::Module.find(module_name, environment_name)
20   if pup_module.nil?
21     raise Puppet::Module::MissingModule, _("Module %{module_name} not found in environment %{environment_name}.") %
22                                           {module_name: module_name, environment_name: environment_name}
23   end
24 
25   plan = pup_module.plans.find { |t| t.name == plan_name }
26   if plan.nil?
27     raise Puppet::Module::Plan::PlanNotFound.new(plan_name, module_name)
28   end
29 
30   begin
31     plan.validate
32     {:metadata => plan.metadata, :files => plan.files}
33   rescue Puppet::Module::Plan::Error => err
34     { :metadata => nil, :files => [], :error => err.to_h }
35   end
36 end
plans_per_environment(environment_name) click to toggle source
   # File lib/puppet/info_service/plan_information_service.rb
 5 def self.plans_per_environment(environment_name)
 6   # get the actual environment object, raise error if the named env doesn't exist
 7   env = Puppet.lookup(:environments).get!(environment_name)
 8   env.modules.map do |mod|
 9     mod.plans.map do |plan|
10       {:module => {:name => plan.module.name}, :name => plan.name}
11     end
12   end.flatten
13 end