title: Order of resources in a class using ensure_packages
body: <p>I have a puppet class that uses the apt library and puppet's stdlib, this is the code:</p>
  
  <pre><code>class mymodule::gcc_48
  {
    if $::lsbdistrelease == 12.04 {
  
      include apt
      apt::ppa { 'ppa:ubuntu-toolchain-r/test': }
      ensure_packages( ['gcc-4.8', 'g++-4.8'] )
  
      exec { 'update_alternatives_gcc':
        command =&gt; '/usr/sbin/update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50',
        creates =&gt; '/etc/alternatives/gcc'
      }
  
      exec { 'update_alternatives_gpp':
        command =&gt; '/usr/sbin/update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50',
        creates =&gt; '/etc/alternatives/g++'
      }
    }
  }
  </code></pre>
  
  <p>I need puppet to do all of these things in the order it's written (well, except for the last two exec) but it's not clear to me how to write the dependency relationship that includes ensure_packages. I tried using the ordering arrows (->) but these don't work with functions (i.e. with ensure_packages).</p>
  
  <p>As written, the resources are applied all out of order and it takes several runs of puppet for everything to work.</p>
  
  <p>I want to try to keep all of this code in the same class if that's possible.</p>