Bug #2455

Misleading/ambiguous error message on invalid fact code should be changed

Added by Scott McCool almost 3 years ago. Updated over 2 years ago.

Status:Closed Start date:07/28/2009
Priority:Low Due date:
Assignee:Paul Nasrat % Done:

0%

Category:-
Target version:1.5.7
Keywords: Affected Facter version:
Branch:
Votes: 0

Description

If an invalid custom fact is added to a system Facter seems to have a generic error:

“Could not retrieve : non-sh interpreters are not currently supported”

To me this error indicates a problem with the interpreter line (first line of the script), which doesn’t apply to Facter scripts as far as I can tell. I’ve found two problems that can cause this error: 1) Missing the “setcode do […] end” stanza 2) Invalid file permissions (chmod 000 test_fact_invalid.rb)

To demonstrate:


[facter]# cat test_fact_invalid.rb

test_fact.rb

Facter.add(“test_fact_invalid”) do

setcode do

            "test value"

end

end [facter]# FACTERLIB=/var/lib/puppet/lib/facter/ facter | grep invalid Could not retrieve test_fact_invalid: non-sh interpreters are not currently supported [facter]# chmod 000 test_fact_invalid.rb [facter]# FACTERLIB=/var/lib/puppet/lib/facter/ facter | grep test_fact

Could not retrieve test_fact_invalid: non-sh interpreters are not currently supported

When test_fact_invalid.rb is moved out of the way and only a valid custom fact remains, the error disappears:

[facter]# cat test_fact.rb

test_fact.rb

Facter.add(“test_fact”) do

    setcode do
            "test value"
    end

end [facter]# FACTERLIB=/var/lib/puppet/lib/facter/ facter | grep test_fact test_fact => test value

[facter]#

I believe a more descriptive error message should be displayed when possible, or if not possible this message be changed to something even more generic which might help newbies such as myself debug.

Thanks!

History

Updated by Luke Kanies almost 3 years ago

  • Status changed from Unreviewed to Accepted

Updated by Paul Nasrat over 2 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Assignee set to Paul Nasrat
  • Target version set to 1.6.0

Can you check tickets/master/2455 on my github (also sent to list via mail_patches).

Updated by Paul Nasrat over 2 years ago

  • Status changed from In Topic Branch Pending Review to Ready For Checkin

Updated by Paul Nasrat over 2 years ago

  • Status changed from Ready For Checkin to Closed

commit:bfe8a2a9e7a03c2a09273ef74d59e2843f5359ae

Updated by Paul Nasrat over 2 years ago

  • Target version changed from 1.6.0 to 1.5.7

Also available in: Atom PDF