Issue #4239 has been reported by Sylvain Avril.
----------------------------------------
Bug #4239: Function returning binary content trigger sql error with stored
config
http://projects.puppetlabs.com/issues/4239
Author: Sylvain Avril
Status: Unreviewed
Priority: Normal
Assigned to:
Category: stored configuration
Target version:
Affected version: 0.25.5
Keywords:
Branch:
To generate SSL certificates on the puppet server and distributing them to
puppet clients, I have created a small parser function.
Unfortunately, it trigger a SQL exception with stored config :
SQLite3::SQLException: unrecognized token: "'7H^É9¸X509KEY": INSERT INTO
"param_values" ("param_name_id", "updated_at", "line", "resource_id", "value",
"created_at") VALUES(5, '2010-07-15 17:35:42', 81, 359, '7H^É9¸X509KEY
It appears that the binary content is not escaped before passing it to the SQL
database.
Here's a small piece of code which reproduce the problem:
module Puppet::Parser::Functions
newfunction(:getBinaryContent, :type => :rvalue) do
|args|
filename="/bin/echo"
filesize = File.size(filename)
content = IO.read(filename,
filesize, 0)
return content
end
end
And the manifest :
file {"/root/mybinary":
ensure => present,
content => getBinaryContent();
}
I don't know how exactly store config works but it seem a bad idea to have the
content param of the file stored in DB. Is the content of all file generated by
template stored in DB ?
--
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://projects.puppetlabs.com/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.