-
Notifications
You must be signed in to change notification settings - Fork 190
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
Add an Environment Variable 'refresh' before installing package #255
Comments
From @gaelcolas on July 25, 2016 15:56 By the way, the core functionality should probably be provided by PackageManagement module (as in, not the DSC resource), or the Chocolatey provider. |
From @jianyunt on July 25, 2016 16:40 @gaelcolas. We welcome contributions from the community, i.e., accept PR. |
From @gaelcolas on August 26, 2016 15:59 I talked with @grayzu about this, and I'm not sure about how to implement such refresh in the LCM, but would be happy to submit a PR if given a bit guidance. |
We need to talk to DSC team to see if DSC Environment Resource can handle it. |
Thanks @jianyunt. The key here is that the host process for the LCM is not refreshed during a run, and each DSC Resource is then executed in a new thread. So if a resource refreshes the environment variables, it won't affect the calling thread. At the end of that resource processing, that thread being disposed, the next thread for the next resource is started from the parent process that did not refresh the environment variables, and hence inherits those 'old' values. What we'd need is something like a flag to tell the LCM to refresh its environment variables, maybe the same way as the one asking for a reboot: |
From @gaelcolas on July 20, 2016 14:34
Some packages, like RabbitMQ in the Chocolatey Repo, can have their installation customized based on Environment Variables (questionable but common method in *nix environment, and ported applications).
When using DSC and setting variables via the Environment resource (which, btw does not support [EnvironmentVariableTarget]), you'd need to restart before being able to install such package. Would it be possible to add a refresh Environment variable to the process that runs the install-package?
Would you consider a PR with the above?
Here's what the resulting configuration could look like:
The workarounds atm are: restarting, wait for next run, hack by killing session and restarting it, create custom PackageManagement resource to add the functionality...
Copied from original issue: PowerShell/PackageManagementProviderResource#29
The text was updated successfully, but these errors were encountered: