Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:05:36+00:00 2026-06-15T03:05:36+00:00

I have the following node definition: { prestashop_sites : { site1: { username: dave,

  • 0

I have the following node definition:

{
    "prestashop_sites" : {
       "site1": { "username": "dave", "password" :"password123", "URL":"www.madeup.com" },
       "site2": { "username": "dave2", "password" :"password12", "URL":"www.madeup2.com" }
    },
       "run_list": [
       "recipe[prestashop]"
    ]
}

And the recipe:

node["prestashop_sites"].each do |site|
        username site['username']
        Chef::Log.debug("Found a server: #{site['username']}")
end

remote_file "/tmp/prestashop152.zip" do
        source "http://www.prestashop.com/download/old/prestashop_1.5.2.0.zip"
        mode "0644"
        checksum "37aee9ef5388376e4377aeb240ab027e"
        backup false
        not_if "test -f /tmp/prestashop152.zip"
end

execute "unzip -o /tmp/prestashop152.zip -d #{node[:prestashop][:location]}" do
        not_if "test -f /var/www/#{node[:prestashop][:user]}/prestashop/index.php"
end

So my goal is to install several instances of prestashop (after I complete the script).

But i’m stuck:

10:  node["prestashop_sites"].each do |site| 
11>>    Chef::Log.debug("Found a server: #{site['username']}")
12:  end

Mon, 12 Nov 2012 21:26:14 +0100] DEBUG: Re-raising exception: 
                                        TypeError - can't convert String into Integer

Any idea why ?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:05:37+00:00Added an answer on June 15, 2026 at 3:05 am

    You have a hash as a subelement of *node[“prestashop_sites”]*, not an array. So you have to provide 2 variables to each method. 1 is for key, another for value:

    10>>!  node["prestashop_sites"].each do |key, site| 
    11:    Chef::Log.debug("Found a server: name: #{key}, #{site['username']}")
    12:  end
    

    Will print “Found a server: name: site1, dave” for the first site.

    The “strange” error you get: TypeError – can’t convert String into Integer, is because when you provide only 1 variable to the each method, ruby tries to put both key and value into that variable. Which ends the value of [key, value] assigned, which in your case means that

    site == [“site”, { “username”: “dave”, “password” :”password123″, “URL”:”www.madeup.com” }]

    An array actually, and you try to access an array element with string index and not integer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following method definition in my class: def show_values(self): for node in
I have the following controller/route definition in Node.js (using Express and Mongoose). What would
Well, I have the following class definitions: private ObservableCollection<Node> _Nodes; public ObservableCollection<Node> Nodes {
I have the following node(s) which I retrieve in a streamreader. There could be
I have the following Node.js directory structure. |--app/ |--app.js |--routers/ |--index.js/ |--models/ |--schemas.js |--post.js
I have the following node.js server-side code: var app = require('http').createServer(handler) , io =
I have the following express node.js app. It's using the 'redis' npm package. app.get(/test,function(req,res){
I am developing a network protocol In which I have following requirement each node
We have the following example in node.js var http = require('http'); http.createServer(function(request, response) {
I have following xml and I want to fetch the value of node which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.