[X] I have verified this is the correct repository for opening this issue.
[X] I have verified no other issues exist related to my problem.
[X] I have verified this is not an issue for a specific package.
[X] I have verified this issue is not security related.
[X] I confirm I am using official, and not unofficial, or modified, Chocolatey products.
What You Are Seeing?
Hi,
I am unable to find source code for install.ps1 script, so I decided to post here. Please point me to the right repo if this is not the correct one.
We're using cChoco DSC module v2.5.0 (the latest one) to install Chocolatey and manage packages. As of today (or the last few days), it looks like the official install script (https://community.chocolatey.org/install.ps1) doesn't work with cChocoInstaller DSC resource.
When the resource runs on a new machine with no Chocolatey installed, the resource runs the official script, which aborts with the warning about Chocolatey being installed:
WARNING: An existing Chocolatey installation was detected. Installation will not continue. This script will not
overwrite existing installations.
If there is no Chocolatey installation at 'C:\ProgramData\chocolatey', delete the folder and attempt the installation
again.
Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.
If the existing installation is not functional or a prior installation did not complete, follow these steps:
- Backup the files at the path listed above so you can restore your previous installation if needed.
- Remove the existing installation manually.
- Rerun this installation script.
- Reinstall any packages previously installed, if needed (refer to the lib folder in the backup).
Once installation is completed, the backup folder is no longer needed and can be deleted.
I had a look at the code for both cChocoInstaller and install.ps1 script and there seems to be a bit of a clash in logic: cChocoInstaller resource will create an empty installation dir in Install-Chocolatey cmdlet before executing install.ps1.
However, Test-ChocolateyInstalled cmdlet in the install.ps1 script will return $true if the install directory exists, even if it's empty (at the time of this writing, lines 322-330, the else clause).
Ideally, both projects could be patched to avoid this kind of issue in the future: there's no need for cChocoInstaller to create an empty install directory (the installer script is supposed to do that). And the install script should be ok with the install directory existing if it's empty (the one corner case here would be if there are two concurrent install scripts running on the system and we get into a bit of a race condition).
What is Expected?
cChocoInstaller resource to install Chocolatey on a fresh system.
How Did You Get This To Happen?
Provision a new Windows machine or uninstall Chocolatey.
Run DSC configuration with cChocoInstaller DSC resource.
Observe it fail.
System Details
Operating System: Windows Server 2022 (10.0.20348.0)
Windows PowerShell version: 5.1.20348.1850
Chocolatey CLI Version: 2.2.2
Chocolatey Licensed Extension version: choco list chocolatey.extension --exact
Chocolatey License type: personal
Terminal/Emulator: Windows PowerShell
Installed Packages
none
Output Log
WARNING: An existing Chocolatey installation was detected. Installation will not continue. This script will not
overwrite existing installations.
If there is no Chocolatey installation at 'C:\ProgramData\chocolatey', delete the folder and attempt the installation
again.
Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.
If the existing installation is not functional or a prior installation did not complete, follow these steps:
- Backup the files at the path listed above so you can restore your previous installation if needed.
- Remove the existing installation manually.
- Rerun this installation script.
- Reinstall any packages previously installed, if needed (refer to the lib folder in the backup).
Once installation is completed, the backup folder is no longer needed and can be deleted.
Checklist
What You Are Seeing?
Hi,
I am unable to find source code for install.ps1 script, so I decided to post here. Please point me to the right repo if this is not the correct one.
We're using
cChoco
DSC modulev2.5.0
(the latest one) to install Chocolatey and manage packages. As of today (or the last few days), it looks like the official install script (https://community.chocolatey.org/install.ps1) doesn't work withcChocoInstaller
DSC resource.When the resource runs on a new machine with no Chocolatey installed, the resource runs the official script, which aborts with the warning about Chocolatey being installed:
I had a look at the code for both
cChocoInstaller
andinstall.ps1
script and there seems to be a bit of a clash in logic:cChocoInstaller
resource will create an empty installation dir inInstall-Chocolatey
cmdlet before executinginstall.ps1
.However,
Test-ChocolateyInstalled
cmdlet in theinstall.ps1
script will return$true
if the install directory exists, even if it's empty (at the time of this writing, lines 322-330, theelse
clause).Ideally, both projects could be patched to avoid this kind of issue in the future: there's no need for
cChocoInstaller
to create an empty install directory (the installer script is supposed to do that). And the install script should be ok with the install directory existing if it's empty (the one corner case here would be if there are two concurrent install scripts running on the system and we get into a bit of a race condition).What is Expected?
cChocoInstaller
resource to install Chocolatey on a fresh system.How Did You Get This To Happen?
cChocoInstaller
DSC resource.System Details
Installed Packages
Output Log