Skip to content

Commit

Permalink
Merge pull request #108 from edward-harley/fix_failed_nodes_report
Browse files Browse the repository at this point in the history
Fix failed nodes report
  • Loading branch information
bastelfreak authored Oct 1, 2024
2 parents dedafb4 + d0f2769 commit 939afae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/catalog-diff/compilecatalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def compile_catalog(node_name, server, certless, tls_cert, tls_key, tls_ca, deri
else
Puppet.runtime[:http].get(uri, headers: headers, options: { ssl_context: ssl_context })
end
raise "HTTP request to Puppetserver #{server} failed with: HTTP #{ret.code} - #{ret.reason}" unless ret.success?
raise "HTTP request to Puppetserver #{server} failed with: HTTP #{ret.code} - #{ret.body}" unless ret.success?
rescue Exception => e
raise "Failed to retrieve catalog for #{node_name} from #{server} in environment #{environment}: #{e.message}"
end
Expand Down
5 changes: 3 additions & 2 deletions lib/puppet/face/catalog/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
# User passed us two hostnames
old_catalogs = Dir.mktmpdir("#{catalog1.tr('/', '_')}-")
new_catalogs = Dir.mktmpdir("#{catalog2.tr('/', '_')}-")
pull_output = Puppet::Face[:catalog, '0.0.1'].pull(
@pull_output = Puppet::Face[:catalog, '0.0.1'].pull(
old_catalogs, new_catalogs,
options[:fact_search],
old_server: catalog1, new_server: catalog2,
Expand All @@ -237,7 +237,7 @@
nodes = diff_output
FileUtils.rm_rf(old_catalogs)
FileUtils.rm_rf(new_catalogs)
nodes[:pull_output] = pull_output
nodes[:pull_output] = @pull_output
return nodes
end
raise 'No nodes were matched' if nodes.size.zero?
Expand All @@ -258,6 +258,7 @@
nodes[:total_nodes] = total_nodes
nodes[:date] = Time.new.iso8601
nodes[:all_changed_nodes] = with_changes.keys
nodes[:pull_output] = @pull_output unless @pull_output.nil?

if options[:output_report]
Puppet.notice("Writing report to disk: #{options[:output_report]}")
Expand Down

0 comments on commit 939afae

Please sign in to comment.