Bug #2392

Client sends yaml and server expects marshal

Added by Jordan Curzon over 2 years ago. Updated over 2 years ago.

Status:Closed Start date:07/04/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:plumbing
Target version:0.25.0
Affected Puppet version:0.24.8 Branch:
Keywords:
Votes: 0

Description

Here is a capture of the client putting marshal first on the accept line but the body of the post is in Yaml. The server exception it causes is at the bottom. If the client wants a certain format should it be able to PUT data in a different format? Or should the client be required to always receive data in the same format that it used to send data?

PUT /production/report/puppetclient.curzons.net HTTP/1.1
Host: puppet:8140
Accept: marshal, yaml, raw
Content-Type: application/x-www-form-urlencoded
X-Client-DN: /CN=puppetclient.curzons.net
X-Client-Verify: SUCCESS
X-Forwarded-For: 10.157.0.102
X-Forwarded-Host: puppet:8140
X-Forwarded-Server: puppetmasterd.curzons.net
Connection: Keep-Alive
Content-Length: 3721

--- !ruby/object:Puppet::Transaction::Report 
host: puppetclient.curzons.net
logs: 
- !ruby/object:Puppet::Util::Log 
  level: :debug
  message: requires File[/opt/testing/puppet/modularclientscripts]
  source: //Node[puppetclient]/sudo/File[scripts_bootloader]/require
  tags: 
  - debug
  time: 2009-07-04 11:54:24.584796 +00:00

  ........ (Full request trace attached)

This exception is caused by Marshal trying to read Yaml data.

/opt/puppet/lib/puppet/network/formats.rb:46:in `load'
/opt/puppet/lib/puppet/network/formats.rb:46:in `intern'
/opt/puppet/lib/puppet/network/format_handler.rb:13:in `send'
/opt/puppet/lib/puppet/network/format_handler.rb:13:in `protect'
/opt/puppet/lib/puppet/network/format_handler.rb:28:in `intern'
/opt/puppet/lib/puppet/network/format_handler.rb:79:in `convert_from'
/opt/puppet/lib/puppet/network/http/handler.rb:121:in `do_save'
/opt/puppet/lib/puppet/network/http/handler.rb:47:in `send'
/opt/puppet/lib/puppet/network/http/handler.rb:47:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/opt/puppet/lib/puppet/network/http/mongrel.rb:22:in `listen'
/opt/puppet/lib/puppet/network/server.rb:131:in `listen'
/opt/puppet/lib/puppet/network/server.rb:146:in `start'
/opt/puppet/lib/puppet/daemon.rb:128:in `start'
/opt/puppet/lib/puppet/application/puppetmasterd.rb:96:in `main'
/opt/puppet/lib/puppet/application.rb:226:in `send'
/opt/puppet/lib/puppet/application.rb:226:in `run_command'
/opt/puppet/lib/puppet/application.rb:217:in `run'
/opt/puppet/sbin/puppetmasterd:66
err: Could not intern from marshal: incompatible marshal file format (can't be read)
        format version 4.8 required; 35.60 given

watch0003.request - Full request trace (4 kB) Jordan Curzon, 07/04/2009 12:03 pm

History

Updated by Jordan Curzon over 2 years ago

I’m trying to create a fix for this. It appears that the server always reads reports in yaml format. Is that true?

Updated by Brice Figureau over 2 years ago

Jordan Curzon wrote:

I’m trying to create a fix for this. It appears that the server always reads reports in yaml format. Is that true?

Actually we can only use yaml for report because Marshal doesn’t know how to serialize hash with default proc. See the code in 0.25 in transaction/report.rb, where I left a comment about this.

Unfortunately for save, the server uses the client Accept-Encoding as the Content-Type. The client should always send a Content-Type when saving. The Accept-Encoding is for the reverse it tells the server what the client can digest.

Updated by Jordan Curzon over 2 years ago

I have a patch I’m cleaning up that does just that.

Updated by James Turnbull over 2 years ago

  • Category set to plumbing
  • Status changed from Unreviewed to Accepted
  • Target version set to 0.25.0

Updated by James Turnbull over 2 years ago

  • Status changed from Accepted to Closed

Pushed in commit:1e83aadc749aea9d52281d4f4041f6144a7229c7 in branch master.

Also available in: Atom PDF