title: Groovy .each only iterates one time
body: <p>The script is not iterating through all the values of the 'modules' array.</p>
  
  <pre class="lang-html prettyprint-override"><code>class Module {
      public String name = '';
      public Boolean isCustom = false;
      public Module(String name, Boolean custom){
          this.name = name;
          this.isCustom = custom;
      }
  }
  
  //creates array from the ext_module env var
  modules = [];
  EXT_MODULE.split(',').each { 
      modules.add(new Module(it, false));
  }
  
  
  println modules;
  modules.each {  
      println "MODULE NAME ::::: ${it.name}"
      if(it.isCustom)
      {
          println "install custom";
      } else {
          println "install non custom";
      }
  };
  </code></pre>
  
  <p>This is the result of the run. The array shows 4 elements, but the code inside the .each black only executes once. </p>
  
  <blockquote>
    <p>Running: Print Message
    [Module@71f09325, Module@e1ddb41, Module@7069a674, Module@1f68f952]<br>
    Running: Print Message
    MODULE NAME ::::: puppetlabs-ntp<br>
    Running: Print Message
    install non custom<br>
    Running: End of Workflow<br>
    Finished: SUCCESS</p>
  </blockquote>