Issue #16922 has been updated by Matthaus Owens.

Status changed from Merged - Pending Release to Closed

Released in Puppet 3.0.1-rc1
----------------------------------------
Bug #16922: Could not intern from b64_zlib_yaml when fact value ends with a 
colon
https://projects.puppetlabs.com/issues/16922#change-73409

Author: Josh Cooper
Status: Closed
Priority: Normal
Assignee: 
Category: 
Target version: 3.0.1
Affected Puppet version: 3.0.0
Keywords: zaml yaml intern colon
Branch: https://github.com/puppetlabs/puppet/pull/1223


In 3.0.0, start a master:

<pre>
$ puppet master --no-daemonize --trace --autosign=true --debug
</pre>

Start an agent, with a fact whose value ends in a colon:

<pre>
env FACTER_myfact=c: puppet agent --test --debug
...
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Could not intern from b64_zlib_yaml: syntax error on line 8, col 14: `    
myfact: c:'
</pre>

The master fails to parse the facts:

<pre>
Error: Could not intern from b64_zlib_yaml: syntax error on line 8, col 14: `   
 myfact: c:'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in
 `load'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in
 `load'
/Users/josh/work/puppet/lib/puppet/network/formats.rb:75:in `decode'
/Users/josh/work/puppet/lib/puppet/network/formats.rb:41:in `requiring_zlib'
/Users/josh/work/puppet/lib/puppet/network/formats.rb:74:in `decode'
/Users/josh/work/puppet/lib/puppet/network/formats.rb:48:in `intern'
/Users/josh/work/puppet/lib/puppet/network/format_handler.rb:12:in `send'
/Users/josh/work/puppet/lib/puppet/network/format_handler.rb:12:in `protect'
/Users/josh/work/puppet/lib/puppet/network/format_handler.rb:26:in `intern'
/Users/josh/work/puppet/lib/puppet/network/format_handler.rb:108:in 
`convert_from'
/Users/josh/work/puppet/lib/puppet/indirector/catalog/compiler.rb:23:in 
`extract_facts_from_request'
/Users/josh/work/puppet/lib/puppet/indirector/catalog/compiler.rb:31:in `find'
/Users/josh/work/puppet/lib/puppet/indirector/indirection.rb:191:in `find'
/Users/josh/work/puppet/lib/puppet/network/http/handler.rb:108:in `do_find'
/Users/josh/work/puppet/lib/puppet/network/http/handler.rb:71:in `send'
/Users/josh/work/puppet/lib/puppet/network/http/handler.rb:71:in `process'
/Users/josh/work/puppet/lib/puppet/network/http/webrick/rest.rb:24:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in
 `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in
 `run'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:33:in `listen'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in
 `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in
 `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in
 `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in
 `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in
 `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in
 `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in
 `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in
 `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in
 `start'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:30:in `listen'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:29:in `initialize'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:29:in `new'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:29:in `listen'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:26:in `synchronize'
/Users/josh/work/puppet/lib/puppet/network/http/webrick.rb:26:in `listen'
/Users/josh/work/puppet/lib/puppet/network/server.rb:92:in `listen'
/Users/josh/work/puppet/lib/puppet/network/server.rb:104:in `start'
/Users/josh/work/puppet/lib/puppet/daemon.rb:136:in `start'
/Users/josh/work/puppet/lib/puppet/application/master.rb:199:in `main'
/Users/josh/work/puppet/lib/puppet/application/master.rb:148:in `run_command'
/Users/josh/work/puppet/lib/puppet/application.rb:346:in `run'
/Users/josh/work/puppet/lib/puppet/application.rb:438:in `plugin_hook'
/Users/josh/work/puppet/lib/puppet/application.rb:346:in `run'
/Users/josh/work/puppet/lib/puppet/util.rb:500:in `exit_on_fail'
/Users/josh/work/puppet/lib/puppet/application.rb:346:in `run'
/Users/josh/work/puppet/lib/puppet/util/command_line.rb:87:in `execute'
/Users/josh/work/puppet/bin/puppet:4
</pre>

The problem is that the agent is serializing the fact's value as an unquoted 
string, which appears to be a regression of #3957

This change to `lib/puppet/util/zaml.rb` on the agent fixes the problem:
<pre>
-   when ((self =~ /\A[a-zA-Z\/][-\[\]_\/.:a-zA-Z0-9]*\z/) and
+   when ((self =~ /\A[a-zA-Z\/][-\[\]_\/.a-zA-Z0-9]*\z/) and
</pre>

though it's not clear if this is bug in our YAML parser or whether strings 
containing the other non-alphanumeric characters need to be quoted, e.g. `'.'`

This is an issue for anyone using a Windows agent with the env module, since it 
adds `SYSTEMDRIVE=C:` as a fact, or some Unix agents whose `path` fact end with 
a trailing colon.


-- 
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.

Reply via email to