Set an env var for only the provisioner
<p>I need an environment variable added to the front of <code>$PATH</code> that:</p>

<ol>
<li>Doesn't last beyond the provisioning run.</li>
<li>Is dependent i.e. something will be installed earlier in the run that is <em>then</em> is available via <code>$PATH</code>, so I can't set it globally <a href="http://www.puppetcookbook.com/posts/set-global-exec-path.html" rel="nofollow noreferrer">as this cookbook says to</a>.</li>
</ol>

<p>I tried <a href="https://stackoverflow.com/a/18417598/335847">the answer here</a>:</p>

<pre><code>Exec { environment =&gt; [ "foo=$bar" ] }
</code></pre>

<p>but I get the error <code>Error: All resource specifications require names</code>. When I add a name I get other errors about syntax, for which my fiddling around to fix just gives me other errors (the error <code>Syntax error at '}'; expected '}'</code> is my favourite!)</p>

<p>I've tried using <code>export</code> to set it, but I see: <code>Error: Could not find command 'export'</code></p>

<p>I've tried using <code>set</code> and <code>setenv</code> too, with similar results. There must be a straightforward way to do this, but I can't find it.</p>

<p>Any help or insight is much appreciated.</p>

<hr>

<p>Edit: Just to add, these are the available shells:</p>

<pre><code>$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/bin/zsh
/usr/bin/zsh
</code></pre>

<p>zsh is part of the provisioning, but it could be a requirement of the answer, if needs be.</p>