Skip to content

Commit 3973318

Browse files
committed
(PUP-11928) Give more specific error messages for /puppet/v3/tasks API
Currently, when a task is omitted due to a failure, Puppet Server logs an exception with a generic error message and provides no details on how to resolve the error: `ERROR [qtp1527520408-905] [puppetserver] Puppet Failed to validate task` This commit removes the generic message that overrides the original error message in the rescued error. Instead, the rescued error message is logged.
1 parent 5e1cea2 commit 3973318

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/puppet/info_service/task_information_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def self.tasks_per_environment(environment_name)
1313
task.validate
1414
{:module => {:name => task.module.name}, :name => task.name, :metadata => task.metadata}
1515
rescue Puppet::Module::Task::Error => err
16-
Puppet.log_exception(err, 'Failed to validate task')
16+
Puppet.log_exception(err)
1717
nil
1818
end
1919
end

spec/unit/info_service_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
:content => metadata.to_json}]]})
4848
File.write("#{modpath}/#{mod_name}/tasks/atask.json", "NOT JSON")
4949

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

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

0 commit comments

Comments
 (0)