-
Notifications
You must be signed in to change notification settings - Fork 99
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
cChocoPackageInstall doesn't check that the package was actually installed #61
Comments
Can you provide a scenario to replicate? |
Sure! This is all it takes: Configuration FailingDsc
{
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName cChoco
Node localhost
{
cChocoInstaller InstallChocolatey
{
InstallDir = "c:\choco"
}
cChocoPackageInstaller FailingInstaller
{
DependsOn = "[cChocoInstaller]InstallChocolatey"
Name = "This-package-name-has-a-typo"
}
}
} I'm running this with
|
Thanks, once I have some extra time I'll implement something to validate the installer exitcodes and write pester tests :). |
Cool, thanks. I was thinking that there's already a function defined "IsPackageInstalled" that I can call at the end of the package installation process, which appears to work. Does this sound like a good idea? If so, I can submit a PR. |
I think it would be better to throw an error if the package install fails. The IsPackageInstalled is intended to get and test the DSC config. |
Okay sure. I've created a PR https://github.com/Richiban/cChoco/pull/1 -- I'm not asking you to actually merge it in but just to demonstrate what I meant. Thanks |
Any updates on this, it would be handy for the DSC resource to kick back an error if the package actually failed to install. Right now any depending resources on the package installing successfully will subsequently fail which is fine but would be good to know the root cause of the failure was the install of the package. |
This is set to up for grabs for someone to take a look at. |
I'm looking to pick this up. Does anyone know why it's using $packageInstallOuput, $exitCode = Invoke-Expression -Command "(choco install $pName $chocoinstallparams), $?" vs $packageInstallOuput = choco install $pName @chocoinstallparams
$exitCode = $? On second thought, this is probably for the best, I've run into a few Chocolatey packages that can't be installed by the System user and this makes it easier to enhance with a |
@elovelan if you have specific packages you can point to that have issues, that would be most helpful. |
@ferventcoder, is your question about packages that will not install under the System account or about packages that fail? In terms of failure, this is really more about general error handling than just packages that fail to install. The .NET framework and visual studio isolated shells are examples of packages that will not install under the System account. I can't remember the exact reasons, but the error is from the MSI, it's not a Chocolatey-specific issue. The work-around is to install using the built-in |
@elovelan does cChoco not support the Credential option? I was under the impression that DSC supported Credentials across the board? |
@elovelan I was specifically speaking of installers that had issues under the system account (not necessarily packages) |
This is supported as of PS 5.0, unfortunately not everyone is able to move to it in a timely fashion 😄 |
Double quotes like that won't work because $? will be evaluated to whatever the variable contains, sticking with Invoke-Expression, you'd need something like this:
Note the single quotes in line 3 above.
|
There is now a pull request for this issue. #103 |
Any updates on this? |
|
+1 - Could really use this fixed as well - if there anything in particular it's waiting on? Or just the next release? |
I'm affected by this as well. I have an internal 7zip package that I tried to install. Since I'm new to DSC I wanted to see what would happen if intentionally typed the package named 7zip incorrectly. The Start-DscConfiguration completed without error. However, Test-DscConfiguration returns [cChocoPackageInstaller]Install7zip is not in the desired state. Additionally, I have an error in the chocolatey.log that states that the |
This is waiting on PR changes - #103 |
Any updates on this? This does create some nasty surprises on failing installs |
Changes cChocoPackagesInstall to validate choco's exit code. Handles the standard exit codes as documented in Chocolatey's documentation. Fixes issue chocolatey#61 Supersedes chocolatey#103
I've noticed a problem with cChocoPackageInstall -- if the package failed to install (due to the source being misconfigured or the version or package name simply not existing) it's not an error. The failure is logged in the verbose output but the DSC configuration silently continues.
This is a pretty nasty surprise; it appears that the DSC you ran completed successfully but in fact some packages were not installed.
The text was updated successfully, but these errors were encountered: