Couldn't parse JSON in /media/chef/site-cookbooks/LAMP/metadata.json rake aborted! A JSON text must at least contain two octets!

Hello. I’m try to write cookbook LAMP

metadata.rb:

maintainer "vase"
maintainer_email "v.tolstov@selfip.ru"
license "none"
description "Installs/Configures LAMP package"
long_description IO.read(File.join(File.dirname(FILE), ‘README.rdoc’))
version "0.0.1"
depends “apache2”

When i’m try to do :
rake metadata i get error:

root@work:/media/chef/site-cookbooks/LAMP# rake --trace metadata
(in /media/chef)
** Invoke metadata (first_time)
** Execute metadata
Couldn’t parse JSON in /media/chef/site-cookbooks/LAMP/metadata.json
rake aborted!
A JSON text must at least contain two octets!
/usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:146:in
initialize' /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:146:innew’
/usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:146:in parse' /usr/lib/ruby/1.8/chef/cookbook/metadata.rb:401:infrom_json’
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:118:in load_cookbooks' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:116:ineach’
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:116:in load_cookbooks' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:105:ineach_key’
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:105:in load_cookbooks' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:36:ininitialize’
/usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:313:in new' /usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:313 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_chain’
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun’
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load’
/usr/bin/rake:19

В Чтв, 13/05/2010 в 04:42 -0700, v.tolstov@selfip.ru пишет:

Hello. I'm try to write cookbook LAMP

metadata.rb:

maintainer "vase"
maintainer_email "v.tolstov@selfip.ru"
license "none"
description "Installs/Configures LAMP package"
long_description IO.read(File.join(File.dirname(FILE), 'README.rdoc'))
version "0.0.1"
depends "apache2"

When i'm try to do :
rake metadata i get error:

root@work:/media/chef/site-cookbooks/LAMP# rake --trace metadata
(in /media/chef)
** Invoke metadata (first_time)
** Execute metadata
Couldn't parse JSON in /media/chef/site-cookbooks/LAMP/metadata.json
rake aborted!
A JSON text must at least contain two octets!

I'm delete empty json file, and re-run rake metadata

root@work:/media/chef/site-cookbooks/LAMP# rake metadata --trace
(in /media/chef)
** Invoke metadata (first_time)
** Execute metadata
Generating metadata for LAMP
rake aborted!
undefined method generate' for #<JSON::Ext::Generator::State:0x7f92d3f84680> /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:270:in pretty_generate'
/usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:326
/usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:325:in open' /usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:325 /usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:319:in each'
/usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:319
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:137:in each' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:136:in each_value'
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:136:in each' /usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:314 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

--
Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru

Downgrade to json 1.4.2. 1.4.3 doesn't work with chef.

On Thu, May 13, 2010 at 4:42 AM, v.tolstov@selfip.ru wrote:

Hello. I'm try to write cookbook LAMP

metadata.rb:

maintainer "vase"
maintainer_email "v.tolstov@selfip.ru"
license "none"
description "Installs/Configures LAMP package"
long_description IO.read(File.join(File.dirname(FILE), 'README.rdoc'))
version "0.0.1"
depends "apache2"

When i'm try to do :
rake metadata i get error:

root@work:/media/chef/site-cookbooks/LAMP# rake --trace metadata
(in /media/chef)
** Invoke metadata (first_time)
** Execute metadata
Couldn't parse JSON in /media/chef/site-cookbooks/LAMP/metadata.json
rake aborted!
A JSON text must at least contain two octets!
/usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:146:in
initialize' /usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:146:in new'
/usr/lib/ruby/gems/1.8/gems/json_pure-1.4.3/lib/json/common.rb:146:in parse' /usr/lib/ruby/1.8/chef/cookbook/metadata.rb:401:in from_json'
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:118:in load_cookbooks' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:116:in each'
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:116:in load_cookbooks' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:105:in each_key'
/usr/lib/ruby/1.8/chef/cookbook_loader.rb:105:in load_cookbooks' /usr/lib/ruby/1.8/chef/cookbook_loader.rb:36:in initialize'
/usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:313:in new' /usr/lib/ruby/1.8/chef/tasks/chef_repo.rake:313 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

--
Joe Van Dyk
http://fixieconsulting.com