Class: Puppet::InfoService::TaskInformationService Private
- Defined in:
- lib/puppet/info_service/task_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.
Class Method Summary collapse
- .task_data(environment_name, module_name, task_name) ⇒ Object private
- .tasks_per_environment(environment_name) ⇒ Object private
Class Method Details
.task_data(environment_name, module_name, task_name) ⇒ 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.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/puppet/info_service/task_information_service.rb', line 22 def self.task_data(environment_name, module_name, task_name) # raise EnvironmentNotFound if applicable 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 task = pup_module.tasks.find { |t| t.name == task_name } if task.nil? raise Puppet::Module::Task::TaskNotFound.new(task_name, module_name) end begin task.validate {:metadata => task., :files => task.files} rescue Puppet::Module::Task::Error => err { :metadata => nil, :files => [], :error => err.to_h } end end |
.tasks_per_environment(environment_name) ⇒ 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.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet/info_service/task_information_service.rb', line 4 def self.tasks_per_environment(environment_name) # get the actual environment object, raise error if the named env doesn't exist env = Puppet.lookup(:environments).get!(environment_name) env.modules.map do |mod| mod.tasks.map do |task| # If any task is malformed continue to list other tasks in module begin task.validate {:module => {:name => task.module.name}, :name => task.name, :metadata => task.} rescue Puppet::Module::Task::Error => err Puppet.log_exception(err, 'Failed to validate task') nil end end end.flatten.compact end |