chocolatey-community / Chocolatey

PowerShell Module and DSC Resource for Chocolatey Software
MIT License
43 stars 15 forks source link

If Chocolatey has just been installed yet its env variable is missing… #43

Closed kwein1 closed 3 years ago

kwein1 commented 3 years ago

…, force refresh PS and chocolatey environments. This relates to an unusual problem @gaelcolas and I were discussing in January. When FIPS encryption must be set (as it will for US government installations) for Chocolatey to work, after FIPS is successfully set, and chocolatey packages are successfully pushed, a subsequent DSC push without an intervening refreshenv or reboot will fail.

But a refreshenv, with a refresh of the chocolateyprofile fixes that. @gaelcolas thought it would be bad (I agree) to call refreshEnv every time any chocolatey resource was called. I eventually narrowed down where the problem was occurring, and made a test that will only trigger the refreshenv when the DSC push is about fail for want of the refreshenv. Therefore, it doesn't waste time on unneeded refreshenv's.

Note: I added a Write-Verbose right before my code to announce what was happening. If that is too "chatty", it can certainly be removed.

kwein1 commented 3 years ago

Gael,

Is there now a 0.0.80 version out … somewhere? I naively tried “Install-Module Chocolatey” on a fresh server, and still get 0.0.79, dated March 3.

Kevin Weinrich Vision Technologies Inc. Contractor to ORD Automation and Scripting Engineer 706-255-2973

From: Gael @.> Sent: Friday, April 2, 2021 9:37 AM To: chocolatey-community/Chocolatey @.> Cc: Weinrich, Kevin @.>; Author @.> Subject: Re: [chocolatey-community/Chocolatey] If Chocolatey has just been installed yet its env variable is missing… (#43)

@gaelcolas approved this pull request.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchocolatey-community%2FChocolatey%2Fpull%2F43%23pullrequestreview-626987309&data=04%7C01%7CWeinrich.Kevin%40epa.gov%7Cb04adc37837a442e66b708d8f5dc94d2%7C88b378b367484867acf976aacbeca6a7%7C0%7C0%7C637529677890220335%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HeMJJGfgF%2FxZLOK6IEU15fLqGD9aSyzkIoOH%2BDqVN7k%3D&reserved=0, or unsubscribehttps://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABACT25AXCBRGTO4HRMMNS3TGXCBFANCNFSM4ZNAXQ5A&data=04%7C01%7CWeinrich.Kevin%40epa.gov%7Cb04adc37837a442e66b708d8f5dc94d2%7C88b378b367484867acf976aacbeca6a7%7C0%7C0%7C637529677890230290%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=J7kl7eMVjZgp8RCj94BxNijCX1qKaOjOgilAlQZlx2Y%3D&reserved=0.