fuel-library/tests/noop/spec/lib/debug.rb
Dmitry Ilyin 854d30ecd9 Noop tests update
* Refactor "globals yaml" feature
* Add "task facts" feature
* Add tasts for the master node tasks
* Improve "status debug" message
* Many minor fixes

Closes-bug: #1517481

Change-Id: I6cb36ac45c75a3f4371580744007a3225bc0ec8e
2015-11-23 23:07:49 +03:00

43 lines
860 B
Ruby

class Noop
module Debug
def debug(msg)
puts msg if ENV['SPEC_PUPPET_DEBUG']
end
def hiera_data_yaml_files
hiera_config.fetch(:hierarchy, []).map do |element|
File.join hiera_data_path, "#{element}.yaml"
end
end
def status_report_template
<<-'eos'
<%= '=' * 80 %>
Node: <%= fqdn or '?' %>
OS: <%= current_os context %>
Role: <%= role or '?' %>
YAML: <%= astute_yaml_path %>
Spec: <%= current_spec context %>
Manifest: <%= manifest_path %>
<% if ENV['SPEC_CATALOG_CHECK'] -%>
Catalog: <%= catalog_dump_file_path context %>
<% end -%>
Hiera:
<% hiera_data_yaml_files.each do |element| -%>
* <%= element %>
<% end -%>
<%= '=' * 80 %>
eos
end
def status_report(context)
ERB.new(status_report_template, nil, '-').result(binding)
end
end
extend Debug
end