Issue Details (XML | Word | Printable)

Key: CHEF-634
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Adam Jacob
Reporter: Bryan McLellan
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Chef

UI fails silently when unable to save node

Created: 23/Oct/09 08:37 PM   Updated: 10/Nov/09 03:00 AM   Resolved: 30/Oct/09 02:14 AM
Component/s: Chef Server
Affects Version/s: 0.7.14
Fix Version/s: 0.8.2

Environment:

ubuntu intrepid + karmic, couchdb 0.8.0 + 0.10.0, chef 0.7.7 (gem) + 0.7.10-0ubuntu1 (deb), ohai 0.3.2-1 (deb).



 Description  « Hide

A failure in the block of code that updates the node and saves it is silently rescued in chef-server-slice/app/controllers/nodes.rb, which drops you back on the edit page rather than the show page without any other indication that a failure occurred, or information as to what the error was.



Sort Order: Ascending order - Click to sort in descending order

Scott M. Likens added a comment - 28/Oct/09 09:49 PM

I was playing with this and was able to reproduce this 100% of the time with 100% valid json according to yajl and other json verifiers.

Credit goes to StormSilver for the failjson.

Step 1, login, edit node, add networking child (can be anything really)
Step 2, insert failjson into this new thing, hit save... it says it's fine right? right so hit save...
Step 3, oops silent rescue brings you back to step 1 without your changes.

See http://gist.github.com/220882


Eric Hankins added a comment - 28/Oct/09 09:54 PM - edited

Actually, I was able to reduce the problem further. It's because of the \t character which should be totally okay.

1. Create a new node.
2. Edit the node and paste the following json into the node, replacing anything that's there.
3. Watch as it blows up. Applying btm's patch allows you to see the error:
Parser Error 500
574: unexpected token at '{"foo":{"bar":"baz quux"}}'

failjson:
{
"foo": { "bar": "baz\tquux" }
}

btm's patch:
http://github.com/btm/chef/commit/f29b3c0848c59cc1dc48f93003140179b0a79889

And a ruby program that fails with the same JSON:
http://gist.github.com/220888


Bryan McLellan added a comment - 28/Oct/09 10:01 PM

There's definitely a second bug to be had where the UI expands the tabs when they're loaded but fails to escape them again when it tries to write them. It shouldn't convert them at all. I found this rescue because of tabs, escaped unicode in the JSON in my case.


Adam Jacob added a comment - 29/Oct/09 03:40 PM

Can you re-base your patch against the current master (0.8)?

Also, it looks like we should resolve this bug, and open a new one regarding escaping and valid JSON creation.


Bryan McLellan added a comment - 29/Oct/09 10:49 PM

UI/jsoneditor bug opened as CHEF-659


Bryan McLellan added a comment - 30/Oct/09 02:14 AM - edited

http://github.com/btm/chef/tree/chef-634 (rebased against 0.8.0)

untested, I still haven't gotten 0.8 running, but it should be fine.


AJ Christensen added a comment - 30/Oct/09 02:20 AM

triage


Adam Jacob added a comment - 10/Nov/09 03:00 AM

Thanks, everyone. BTM's patch is applied to make the messages more verbose, and pcrossley's new JSON editor does proper encoding.