title: Passing puppet exec command to a variable
body: <p>I have an ssl cert file that I want to convert into a string before uploading using puppet. Below is what I have:</p>
  
  <pre><code>class ssl_cert {
  
    $cert='domain.com.crt';
    $key='domain.com.key';
  
    file { $urlcert :
      ensure =&gt; present,
    }
  
    file { $key :
      ensure =&gt; present,
    }
  
    exec { 'Use $cert':
      path    =&gt; '/opt/',
      require =&gt; File[$cert],
      command =&gt; "/bin/sed -E ':a;N;$!ba;s/\r*\n/\\n/g' $cert",
    }
  
    exec { 'Use $key':
      path    =&gt; '/opt/',
      require =&gt; File[$key],
      command =&gt; "/bin/sed -E ':a;N;$!ba;s/\r*\n/\\n/g' $key",
    }
  
    #Upload ssl cert for vhost
    brocadevtm::ssl_server_keys { 'domain.com' :
      ensure          =&gt; present,
      basic__note     =&gt; '',
      basic__private  =&gt; $cert,
      basic__public   =&gt; $key,
    }
  }
  </code></pre>
  
  <p>Is there a way to pass the exec command (command => "/bin/sed -E ':a;N;$!ba;s/\r*\n/\n/g' $cert",) to a variable which can be called later and used for the values  basic__private  => ' ' and basic__public => ' '? as it is now, those values are just picking up domain.com.crt and domain.com.key from the variables above but I want to use the output of the command instead and not the file.</p>