[chef] Re: Re: convert ruby attributes to json ?


Chronological Thread 
  • From: Vladimir Skubriev < >
  • To:
  • Subject: [chef] Re: Re: convert ruby attributes to json ?
  • Date: Thu, 10 Oct 2013 13:30:11 +0400

On 10/10/2013 12:52 PM, Matthew Moretti wrote:
" type="cite">

Looks like you might be missing a set of square brackets. I’m not familiar with the cookbook, but the ruby you posted has default['rvm']['user_installs'] set to an array of hashes. So I think you want:

"override_attributes": {
    "rvm": {
       "user_installs": [{
        "user": "www-data",
         "default_ruby": "2.0.0p247",
        "global_gems": [
           {
            "name": "rake"
           },
          {
             "name": "bundler"
          },
           {
            "name": "json"
           },
          {
             "name": "mysql2"
          },
           {
            "name": "libxml-ruby"
           },
          {
             "version": "4.0.20",
            "name": "passenger"
           }
        ]
       }]
    }
   }

Note the square brace on the third and third-from-last line.

Also, if you fire up irb, and require ‘json’ you can just call .to_json on many ruby objects which might help in your conversion.

Matt Moretti


Thank you very much!
-- 
Best regards,

CVision Lab System Administrator
Vladmir Skubriev



Archive powered by MHonArc 2.6.16.

§