Skip to content

Commit

Permalink
Improve error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Jul 5, 2022
1 parent 6d74ddf commit b3a9d1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions tasks/set_puppet_config.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'open3'

require_relative '../../ruby_task_helper/files/task_helper'

class SetPuppetConfig < TaskHelper
Expand All @@ -14,7 +12,7 @@ def task(settings:, **_kwargs)
end

settings.each do |setting_name, setting_value|
Open3.capture3('puppet', 'config', 'set', setting_name.to_s, setting_value.to_s)
system('puppet', 'config', 'set', setting_name.to_s, setting_value.to_s) || raise(TaskHelper::Error.new('Failed to set setting', 'set_puppet_config', 'puppet exited with a non-null error code'))
end

nil
Expand Down
2 changes: 1 addition & 1 deletion tasks/sign_certificate_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def task(certificate_requests:, **_kwargs)

certificate_requests.each do |node, details|
if pending_requests[node] == details
system('puppetserver', 'ca', 'sign', node)
system('puppetserver', 'ca', 'sign', node) || raise(TaskHelper::Error.new('Failed to sign certificate requests', 'sign_certificate_requests', 'puppetserver exited with a non-null error code'))
else
raise TaskHelper::Error.new('Certificate Request not fournd',
'sign_agent_certificate/certificate_request_not_found',
Expand Down

0 comments on commit b3a9d1d

Please sign in to comment.