title: Puppet onlyif and unless conditional test from boolean data in Hiera and CLI script output
body: <p>I am running Puppet v3.0 on RHEL 6 and am doing package management via the <code>exec</code> resource.
  I would like to add a number of control gates into my manifest via <code>onlyif</code> and <code>unless</code>.</p>
  
  <p>First I would like to use booleans as defined in Hiera [ auto lookup function ].
  Secondly I would like to use booleans from a bash script running <code>diff &lt;() &lt;()</code>.</p>
  
  <p>Im using the following hiera data :</p>
  
  <pre><code>---
  my-class::package::patch_now:
   0
  
  my-class::package::package_list:
   acl-2.2.49-6.el6-x86_64
   acpid-1.0.10-2.1.el6-x86_64
  ...etc
  </code></pre>
  
  <p>and my manifest are as follows :</p>
  
  <pre><code># less package.pp
  class my-classs::package(
  $package_list,
  $patch_now,
  ){
     exec {'patch_packages':
        provider =&gt; shell,
        path =&gt; [ "/bin/", "/usr/bin/" ],
        logoutput =&gt; true,
        timeout =&gt; 100,
        command =&gt; "yum update -e0 -d0 -y $package_list",
        unless =&gt; "/path/to/my-diff.script 2&gt;&amp;1 &gt; /dev/null",
        onlyif =&gt; "test 0 -eq $patch_now",
     }
  }
  </code></pre>
  
  <p>How would I test the booleans (0|1) from Hiera and a CLI diff.script with <code>unless</code> and <code>onlyif</code> in the context above ?</p>