Commit 650bc7e0 authored by Ken Barber's avatar Ken Barber Committed by Ryan Senior

(PDB-16) Include warning when environment doesn't exist in report

This throws a warning if users are suffering from bug PUP-2508.
Signed-off-by: default avatarKen Barber <ken@bob.sh>
parent 890f31ee
......@@ -34,6 +34,10 @@ Puppet::Reports.register_report(:puppetdb) do
# @api private
def report_to_hash
profile "Convert report to wire format hash" do
if environment.nil?
raise Puppet::Error, "Environment is nil, unable to submit report. This may be due a bug with Puppet. Ensure you are running the latest revision, see PUP-2508 for more details."
end
{
"certname" => host,
"puppet-version" => puppet_version,
......
......@@ -15,13 +15,7 @@ describe processor do
subject {
s = Puppet::Transaction::Report.new("foo").extend(processor)
s.configuration_version = 123456789
# For backwards compatibility with versions of Puppet that don't
# have an accessor method for the report_format variable
if !s.respond_to?(:report_format)
s.stubs(:report_format).returns(s.instance_variable_get(:@report_format))
end
s.environment = "foo"
s
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment