Sunday, October 20, 2013

Chef server internal error (11.08)

Tried the new version of chef-server 11.08 and looks like is broken. There is a bug into the jira CHEF-4339. I tried onto CentOS but looks like Ubuntu is broken as well (see bug description). How to see the error logs
$ chef-server-ctl tail

==> /var/log/chef-server/nginx/access.log <==
192.168.122.1 - - [20/Oct/2013:14:56:42 +0000]  "PUT /sandboxes/000000000000a38d5dd8e2763f913c6c HTTP/1.1" 500 "8.109" 36 "-" "Chef Knife/11.6.0 (ruby-1.9.3-p429; ohai-6.18.0; x86_64-linux; +http://opscode.com)" "127.0.0.1:8000" "500" "8.049" "11.6.0" "algorithm=sha1;version=1.0;" "chef-user" "2013-10-20T14:54:00Z" "oMRtV6loUDnbKJuGcW6nqBbF8ww=" 1029

==> /var/log/chef-server/erchef/current <==
2013-10-20_14:56:42.62140 
2013-10-20_14:56:42.62144 =ERROR REPORT==== 20-Oct-2013::14:56:42 ===
2013-10-20_14:56:42.62145 webmachine error: path="/sandboxes/000000000000a38d5dd8e2763f913c6c"
2013-10-20_14:56:42.62145 {error,
2013-10-20_14:56:42.62146     {throw,
2013-10-20_14:56:42.62146         {checksum_check_error,26},
2013-10-20_14:56:42.62146         [{chef_wm_named_sandbox,validate_checksums_uploaded,2,
2013-10-20_14:56:42.62147              [{file,"src/chef_wm_named_sandbox.erl"},{line,144}]},
2013-10-20_14:56:42.62147          {chef_wm_named_sandbox,from_json,2,
2013-10-20_14:56:42.62148              [{file,"src/chef_wm_named_sandbox.erl"},{line,99}]},
2013-10-20_14:56:42.62148          {webmachine_resource,resource_call,3,
2013-10-20_14:56:42.62148              [{file,"src/webmachine_resource.erl"},{line,166}]},
2013-10-20_14:56:42.62149          {webmachine_resource,do,3,
2013-10-20_14:56:42.62149              [{file,"src/webmachine_resource.erl"},{line,125}]},
2013-10-20_14:56:42.62150          {webmachine_decision_core,resource_call,1,
2013-10-20_14:56:42.62150              [{file,"src/webmachine_decision_core.erl"},{line,48}]},
2013-10-20_14:56:42.62150          {webmachine_decision_core,accept_helper,0,
2013-10-20_14:56:42.62151              [{file,"src/webmachine_decision_core.erl"},{line,583}]},
2013-10-20_14:56:42.62151          {webmachine_decision_core,decision,1,
2013-10-20_14:56:42.62151              [{file,"src/webmachine_decision_core.erl"},{line,489}]},
2013-10-20_14:56:42.62152          {webmachine_decision_core,handle_request,2,
2013-10-20_14:56:42.62153              [{file,"src/webmachine_decision_core.erl"},{line,33}]}]}}

==> /var/log/chef-server/erchef/erchef.log.1 <==
2013-10-20T14:56:42Z erchef@127.0.0.1 ERR req_id=rOkhxZcSowyaKaD+WsjFKg==; status=500; method=PUT; path=/sandboxes/000000000000a38d5dd8e2763f913c6c; user=chef-user; msg=[]; req_time=8043; rdbms_time=5; rdbms_count=2; s3_time=8028; s3_count=1


However the integration tests all pass ...

$ chef-server-ctl test

...

Sandboxes API Endpoint
  Sandboxes Endpoint, POST
    when creating a new sandbox
      should respond with 201 Created
  Sandboxes Endpoint, PUT
    when committing a sandbox after uploading files
      should respond with 200 OK
Deleting client pedant_admin_client ...
Deleting client pedant_client ...
Pedant did not create the user admin, and will not delete it
Deleting user pedant_non_admin_user ...
Deleting user knifey ...

Finished in 54.02 seconds
70 examples, 0 failures

Hopefully will be fixed soon.

Monday, October 14, 2013

Vim paste tricks

Vim is cool! But sometimes can be annoying - for example you edit your file etc. and have a short snippet of code you want to insert into it, so copy and paste BUT ... vim has the indent on. Now there are different types of indent and you can try to turned them off - see Indenting source code. A neat trick is the :paste option however there are cases where you want to turn off indented for different reasons. You can use something like this into your .vimrc
function! IndentPasteOff()
  set noai nocin nosi inde=
endfunction

function! IndentPasteOn()
  set ai cin si
endfunction

nmap _0  :call IndentPasteOff() 
nmap _1  :call IndentPasteOn() 
" paste on/off
set pastetoggle=
Now you don't want any indent type _0 and to indent again _1. Happy viming!