Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
PUP 4.3.2
-
None
-
1
-
Language 2016-03-09
-
Bug Fix
-
Description
If I have the Puppet::InfoService::ClassInformationService or resource_types endpoint parse a manifest which includes a special UTF-8 character, the resulting default values parsed for parameters appear to be corrupted.
Here is the manifest file I used for this test, also attached as "parse.pp":
class myclass ( |
String $a_string = "this is a Ѐ string", |
Integer $an_integer = 3, |
) {}
|
Note that the character at the end of the comment line is a Cyrillic Capital letter Ye with grave, Unicode code point of U+0400, hex representation of 0xD080 in UTF-8 in the file.
Running the following code...
require 'puppet' |
require 'puppet/info_service' |
|
files_to_parse = { "production" => [ "./parse.pp" ] } |
|
puts Puppet::InfoService::ClassInformationService.new.classes_per_environment(files_to_parse) |
... produces the following output:
{"production"=>{"./parse.pp"=>{:classes=>[{:name=>"myclass", :params=>[{:name=>"a_string", :type=>"String", :default_literal=>"this is a Ѐ string", :default_source=>"\"this is a Ѐ string\","}, {:name=>"an_integer", :type=>"Integer", :default_literal=>3, :default_source=>","}]}]}}}
|
The `:default_literal` values for each parameter appear to be correct but the `:default_source` values do not. Instead of "\"this is a Ѐ string\",", I would have expected "\"this is a Ѐ string\"". Instead of ",", I would have expected "3".
This problem does not appear to be unique to the ClassInformationService. I get the same error when I use the "resource_types" endpoint to query for this data. For a query to "https://localhost:8140/puppet/v3/resource_types/*?kind=class&environment=production" where the "parse.pp" file is stored under the "<code-dir>/environments/production/modules/mymodule/manifests" directory, I get the following response (pretty-printed for display):
[
|
{
|
"kind": "class",
|
"line": 2,
|
"name": "myclass",
|
"parameters": {
|
"a_string": "\"this is a Ѐ string\",",
|
"an_integer": ","
|
}
|
}
|
]
|
Attachments
Issue Links
- links to