Bug #15746

Hiera puppet backend silently ignores exceptions

Added by Ellison Marks 11 months ago. Updated 7 months ago.

Status:AcceptedStart date:07/31/2012
Priority:NormalDue date:
Assignee:Ellison Marks% Done:

0%

Category:-
Target version:-
Affected Puppet version: Branch:
Keywords:debugging

Description

unless loaded_classes.include?(klass)
  begin
    if scope.respond_to?(:function_include)
      scope.function_include(klass)
    else
      scope.real.function_include(klass)
    end
    temp_answer = scope[varname]
    Hiera.debug("Found data in class #{klass}")
  rescue
  end
else
  temp_answer = scope[varname]
end

While working with hiera’s puppet backend, I made a syntax error in one of my data classes, such that when calling a hiera function it would fail to load. Due to the above code, however, there was no indication that such an error was occurring. The only hiera messages when I enabled debug in the puppet master was the following:

Could not find data item classes in any Hiera data file and no default supplied at /etc/puppet/manifests/site.pp

Perhaps something like this would be useful. I added it temporarily to help me find the error.

rescue Exception=>e
  Hiera.debug(e.message)
  Hiera.debug(e.backtrace.inspect)
end

History

#1 Updated by eric sorenson 10 months ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to eric sorenson
  • Affected Hiera-Puppet Version deleted (1.0.0rc2)

Seems reasonable, Ellison. Are you set up to send this in as a pull request?

#2 Updated by eric sorenson 10 months ago

  • Assignee changed from eric sorenson to Ellison Marks

#3 Updated by Ellison Marks 10 months ago

Through github? I have an account but I haven’t done a pull request yet. What’s the procedure?

#4 Updated by Josh Cooper 7 months ago

  • Project changed from Hiera-Puppet to Puppet

#5 Updated by Josh Cooper 7 months ago

HI Ellison, the hiera-puppet code has moved into puppet core as of puppet 3.0. If you’d like to contribute code, please take a look at https://github.com/puppetlabs/puppet/blob/master/README.md which describes how to get started.

Also available in: Atom PDF