Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If possible, update the path for Puppet after a provider run #63

Open
bdruth opened this issue Jun 7, 2015 · 7 comments
Open

If possible, update the path for Puppet after a provider run #63

bdruth opened this issue Jun 7, 2015 · 7 comments

Comments

@bdruth
Copy link

bdruth commented Jun 7, 2015

Is there a trick by which packages installed by chocolatey that update the Machine Path (i.e. [System.Environment]::GetEnvironmentVariable("Path","Machine")) can be used by subsequent Exec calls in the same puppet apply run? I'm having difficulty with nodejs.install and subsequently using the Powershell provider (puppetlabs/powershell) to run npm commands.

Any tricks to make this work? I've created an issue w/ the powershell provider as well, because I can't seem to provide an up-to-date path => ... to the Exec, which seems like a shortcoming or bug of some sort.

@ferventcoder
Copy link
Contributor

This is the million dollar Windows question. Windows does not refresh the path for the current shell, so it can cause issues. The workaround is to determine where something will install and use that as the path.

@ferventcoder
Copy link
Contributor

It is a shortcoming for Windows, and every tool suffers.

@rismoney
Copy link
Contributor

rismoney commented Jun 7, 2015

By default, a child process inherits the environment variables of its parent process. The problem is that with a tool like puppet everything becomes a child process for execution purposes.
The potential work around might involve creating a new process and passing it a pointer to updated env variables. Not sure... But everyone and every product is suffering from this...

@bdruth
Copy link
Author

bdruth commented Jun 8, 2015

Sigh. OK - thanks.

@ferventcoder
Copy link
Contributor

I added https://tickets.puppetlabs.com/browse/PUP-4708 to follow up on whether this is something we can add to Puppet.

@ferventcoder
Copy link
Contributor

There are a few tricks. Perhaps we can make the provider perform them. :)

@ferventcoder ferventcoder reopened this Jul 7, 2015
@ferventcoder ferventcoder changed the title Trick for updating Path for subsequent Exec? If possible, update the path for Puppet after a provider run Jul 7, 2015
@ferventcoder ferventcoder added this to the 1.x milestone Jul 7, 2015
@steve-hawkins
Copy link

I'm sure this module does what you are after : -

https://forge.puppetlabs.com/counsyl/windows#windowsrefresh_environment

DavidS pushed a commit to DavidS/puppetlabs-chocolatey that referenced this issue Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants