Issue #2455 has been updated by Luke Kanies.

Status changed from Unreviewed to Accepted


----------------------------------------
Bug #2455: Misleading/ambiguous error message on invalid fact code should be 
changed
http://projects.reductivelabs.com/issues/2455

Author: Scott McCool
Status: Accepted
Priority: Low
Assigned to: 
Category: 
Target version: 
Complexity: Unknown
Keywords: 


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

"Could not retrieve <fact name>: 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!






-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to