title: Puppet relationship with a Hash
body: <p>I would like to run the following code in a sequential order so that the <code>servers_string</code> variable is computed <strong>before</strong> the script execution.</p>
  
  <p>Unfortunately puppet failed with the following error :</p>
  
  <p><code>Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Illegal relationship operand, can not form a relationship with a Hash. A Catalog type is required.</code></p>
  
  <p>The code snippet :</p>
  
  <pre><code>$servers = [{ name =&gt; 'toto', ip =&gt; '10.0.0.1'}, { name =&gt; 'titi', ip =&gt;  '10.0.0.2' }]
  $servers.each | Hash $server | {
    if $servers_string != "" {
      $servers_string = "${servers_string},"
    }
  
    $name = $server['name']
    $servers_string = "${servers_string}${name}"
  }-&gt;
  
  file { '/my/path/myscript.sh':
      ensure =&gt; file,
      mode   =&gt; '0700',
      owner  =&gt; 'root',
      group  =&gt; 'root',
      source =&gt; "puppet:///modules/${module_name}/install.sh --servers '${servers_string}'"
  }
  </code></pre>
  
  <p>Any idea ? Thanks</p>