Skip to content

Commit

Permalink
Merge pull request #9104 from AriaXLi/PUP-11928/puppet/v3/tasks_API_e…
Browse files Browse the repository at this point in the history
…rror_messages

(PUP-11928) Give more specific error messages for /puppet/v3/tasks API
  • Loading branch information
joshcooper authored Sep 7, 2023
2 parents 5e1cea2 + 3973318 commit db2cf67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/info_service/task_information_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.tasks_per_environment(environment_name)
task.validate
{:module => {:name => task.module.name}, :name => task.name, :metadata => task.metadata}
rescue Puppet::Module::Task::Error => err
Puppet.log_exception(err, 'Failed to validate task')
Puppet.log_exception(err)
nil
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/info_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
:content => metadata.to_json}]]})
File.write("#{modpath}/#{mod_name}/tasks/atask.json", "NOT JSON")

expect(Puppet).to receive(:send_log).with(:err, 'Failed to validate task')
expect(Puppet).to receive(:send_log).with(:err, /unexpected token at 'NOT JSON'/)

@tasks = Puppet::InfoService.tasks_per_environment(env_name)
expect(@tasks.map{|t| t[:name]}).to contain_exactly('test1::btask', 'test1::ctask')
Expand Down

0 comments on commit db2cf67

Please sign in to comment.