title: fail when a file exist in puppet
body: <p>I am trying to write a puppet script which will install a module by un-tar. I want puppet to fail if it is already un tar. I tried to do below code but it always fails even if directory is absent.</p>
  
  <p>I am checking if /opt/sk is present then fail otherwise proceed on installation.</p>
  
  <pre><code>define splunk::fail($target)
  {
      $no = 'true'
      case $no {
           default : { notice($no) }#fail('sk is already installed.')}
      }
  }
  
  define splunk::forwarder( $filename , $target )
  {
      file{"$target/sk":
          ensure =&gt; present
      }
  
      splunk::fail{"NO":
          target =&gt; '/opt/',
          require =&gt; File[$target],
      }
  
      file{"$target/A.tgz":
          source =&gt; $filename ,
          replace =&gt; false ,
      }
  
      exec{"NO1":
          command =&gt; "tar xzvf A.tgz" ,
          cwd =&gt; $target ,
          require =&gt; File["$target/A.tgz"] ,
      }
  
      exec{"Clean":
          command =&gt; "rm -rf A.tgz" ,
          cwd =&gt; target ,
          require =&gt; Exec["NO1"],
      }
  }
  
  splunk::forwarder {"non":
      filename =&gt; 'puppet:///modules/splunk/files/NO.tgz' ,
      target =&gt; '/opt/',
  }
  </code></pre>
  
  <p>Thanks</p>