16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/puppet/info_service/plan_information_service.rb', line 16
def self.plan_data(environment_name, module_name, plan_name)
Puppet.lookup(:environments).get!(environment_name)
pup_module = Puppet::Module.find(module_name, environment_name)
if pup_module.nil?
raise Puppet::Module::MissingModule, _("Module %{module_name} not found in environment %{environment_name}.") %
{ module_name: module_name, environment_name: environment_name }
end
plan = pup_module.plans.find { |t| t.name == plan_name }
if plan.nil?
raise Puppet::Module::Plan::PlanNotFound.new(plan_name, module_name)
end
begin
plan.validate
{ :metadata => plan.metadata, :files => plan.files }
rescue Puppet::Module::Plan::Error => err
{ :metadata => nil, :files => [], :error => err.to_h }
end
end
|