chocolatey / chocolatey-ansible

The Chocolatey module collection for Ansible
GNU General Public License v3.0
47 stars 29 forks source link

Packages are installed during an upgrade when `skipPackageUpgradesWhenNotInstalled` is enabled #137

Open pauby opened 7 months ago

pauby commented 7 months ago

What You Are Seeing?

When the feature skipPackageUpgradesWhenNotInstalled is enabled, and a playbook attempts to upgrade a package that is not present, it is installed.

What is Expected?

When the feature skipPackageUpgradesWhenNotInstalled is enabled, and a playbook attempts to upgrade a package that is not present, it should not be installed (or upgraded).

How Did You Get This To Happen? (Steps to Reproduce)

  1. Run a playbook similar to this against a host capable of running Chocolatey
- name: Reproduction
  hosts: some_host
  tasks:
    - name: Enable Chocolatey Feature to skip not installed packages
      win_chocolatey_feature:
          name: skipPackageUpgradesWhenNotInstalled
          state: enabled

    - name: Update 
      win_chocolatey:
        name:
        - package_does_not_exist
        state: upgrade
  1. Observe that the win_chocolatey module attempted to choco install

image

Please note that the package-not-found error is not related to this issue, and was mostly used as a fast method to show that the module was (arguably) incorrectly attempting to install rather than call upgrade.

System Details

Output Log

chocolatey.log

~~~sh 2023-11-07 16:18:42,159 4840 [DEBUG] - XmlConfiguration is now operational 2023-11-07 16:18:42,174 4840 [DEBUG] - Evaluating license file found at 'C:\ProgramData\chocolatey\license\chocolatey.license.xml' 2023-11-07 16:18:43,127 4840 [DEBUG] - Loading up 'chocolatey.licensed' assembly type from 'C:\ProgramData\chocolatey\extensions\chocolatey\chocolatey.licensed.dll' 2023-11-07 16:18:43,143 4840 [DEBUG] - Minimum Chocolatey Version: '2.0.0' 2023-11-07 16:18:43,143 4840 [DEBUG] - Current Chocolatey Version: '2.2.2.0' 2023-11-07 16:18:43,143 4840 [DEBUG] - Current Chocolatey Licensed Version: '6.1.0.0' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'CygwinService' for type 'IAlternativeSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'CygwinService' for type 'IInstallSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'PythonService' for type 'IAlternativeSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'PythonService' for type 'IListSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'PythonService' for type 'IInstallSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'PythonService' for type 'IUninstallSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'RubyGemsService' for type 'IAlternativeSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'RubyGemsService' for type 'IListSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'RubyGemsService' for type 'IInstallSourceRunner' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'SystemStateValidation' for type 'IValidation' from assembly 'choco' 2023-11-07 16:18:43,174 4840 [DEBUG] - Adding new type 'CacheFolderLockdownValidation' for type 'IValidation' from assembly 'choco' 2023-11-07 16:18:43,549 4840 [DEBUG] - Adding new type 'EmptyOrInvalidUrlMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,549 4840 [DEBUG] - Adding new type 'FrameWorkReferencesMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,549 4840 [DEBUG] - Adding new type 'IconMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,549 4840 [DEBUG] - Adding new type 'LicenseMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,565 4840 [DEBUG] - Adding new type 'PackageTypesMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,565 4840 [DEBUG] - Adding new type 'ReadmeMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,565 4840 [DEBUG] - Adding new type 'RepositoryMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,565 4840 [DEBUG] - Adding new type 'RequireLicenseAcceptanceMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,565 4840 [DEBUG] - Adding new type 'ServicableMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,565 4840 [DEBUG] - Adding new type 'VersionMetadataRule' for type 'IMetadataRule' from assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'cache' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'list' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'template' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'export' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'info' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'help' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'config' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'feature' in assembly 'choco' 2023-11-07 16:18:43,581 4840 [DEBUG] - Registering new command 'new' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'outdated' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'pack' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'pin' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'push' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'apikey' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'source' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'uninstall' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'upgrade' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'search' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'unpackself' in assembly 'choco' 2023-11-07 16:18:43,596 4840 [DEBUG] - Registering new command 'install' in assembly 'choco' 2023-11-07 16:18:43,659 4840 [DEBUG] - Gathering exported extension registration modules! 2023-11-07 16:18:43,706 4840 [DEBUG] - Trying to load and register extension 'chocolatey.licensed' 2023-11-07 16:18:43,721 4840 [DEBUG] - Calling registration module 'ProChocolateyExtensionModule' in extension 'chocolatey.licensed'! 2023-11-07 16:18:43,752 4840 [DEBUG] - Adding new type 'CountdownTask' for type 'ITask' from assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Adding new type 'TerminalServicesChangeUserTask' for type 'ITask' from assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Adding new type 'SynchronizeTask' for type 'ITask' from assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Adding new type 'AdminOnlyFeatureTask' for type 'ITask' from assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Adding new type 'PackagesInProgramsAndFeaturesTask' for type 'ITask' from assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Registering new command 'download' in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Replacing existing command 'feature' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Replacing existing command 'info' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Replacing existing command 'install' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Replacing existing command 'list' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,768 4840 [DEBUG] - Replacing existing command 'new' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Registering new command 'optimize' in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Replacing existing command 'outdated' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Replacing existing command 'pin' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Replacing existing command 'search' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Replacing existing command 'source' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Registering new command 'support' in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Registering new command 'synchronize' in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Replacing existing command 'uninstall' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,784 4840 [DEBUG] - Replacing existing command 'upgrade' from assembly 'choco' with implementation in assembly 'chocolatey.licensed' 2023-11-07 16:18:43,799 4840 [DEBUG] - Loaded extension chocolatey.licensed v6.1.0 with status 'Enabled' 2023-11-07 16:18:43,815 4840 [INFO ] - ============================================================ 2023-11-07 16:18:43,956 4840 [DEBUG] - Chocolatey is running on Windows v 10.0.17763.0 2023-11-07 16:18:43,956 4840 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old". 2023-11-07 16:18:43,956 4840 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old". 2023-11-07 16:18:43,956 4840 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install package_does_not_exist --fail-on-unfound --yes --no-progress --limit-output --timeout 2700 2023-11-07 16:18:43,971 4840 [DEBUG] - Received arguments: install package_does_not_exist --fail-on-unfound --yes --no-progress --limit-output --timeout 2700 2023-11-07 16:18:44,002 4840 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage. 2023-11-07 16:18:44,002 4840 [DEBUG] - CountdownTask is now ready and waiting for PostRunMessage. 2023-11-07 16:18:44,018 4840 [DEBUG] - Terminal services setup not necessary for this session. 2023-11-07 16:18:44,033 4840 [DEBUG] - SynchronizeTask is now ready and waiting for PreRunMessage. 2023-11-07 16:18:44,033 4840 [DEBUG] - PackagesInProgramsAndFeaturesTask is now ready and waiting for PostRunMessage. 2023-11-07 16:18:44,049 4840 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers... 2023-11-07 16:18:44,049 4840 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed... 2023-11-07 16:18:44,065 4840 [DEBUG] - [Synchronize] Updating packages with Programs and Features 2023-11-07 16:18:44,065 4840 [DEBUG] - [Synchronize] Currently only supports removals. Soon will handle updates. 2023-11-07 16:18:44,174 4840 [DEBUG] - Resolving resource PackageSearchResource for source C:\ProgramData\chocolatey\lib 2023-11-07 16:18:44,330 4840 [DEBUG] - chocolatey 2.2.2 2023-11-07 16:18:44,346 4840 [DEBUG] - chocolatey.extension 6.1.0 2023-11-07 16:18:44,346 4840 [DEBUG] - chocolatey-agent 2.1.0 2023-11-07 16:18:44,346 4840 [DEBUG] - chocolatey-compatibility.extension 1.0.0 2023-11-07 16:18:44,362 4840 [DEBUG] - chocolatey-core.extension 1.4.0 2023-11-07 16:18:44,362 4840 [DEBUG] - chocolatey-licensed-jenkins-scripts 0.1.1 2023-11-07 16:18:44,362 4840 [DEBUG] - chocolatey-management-database 0.11.0 2023-11-07 16:18:44,362 4840 [DEBUG] - chocolatey-management-service 0.11.0 2023-11-07 16:18:44,362 4840 [DEBUG] - chocolatey-management-web 0.11.0 2023-11-07 16:18:44,377 4840 [DEBUG] - chocolatey-windowsupdate.extension 1.0.5 2023-11-07 16:18:44,377 4840 [DEBUG] - dbatools 2.1.4 2023-11-07 16:18:44,377 4840 [DEBUG] - dbatools-library.powershell 2023.9.21 2023-11-07 16:18:44,393 4840 [DEBUG] - dotnet-6.0-aspnetruntime 6.0.24 2023-11-07 16:18:44,393 4840 [DEBUG] - dotnet-6.0-runtime 6.0.24 2023-11-07 16:18:44,408 4840 [DEBUG] - dotnet-aspnetcoremodule-v2 16.0.23237 2023-11-07 16:18:44,408 4840 [DEBUG] - jenkins 2.414.3 2023-11-07 16:18:44,408 4840 [DEBUG] - KB2919355 1.0.20160915 2023-11-07 16:18:44,408 4840 [DEBUG] - KB2919442 1.0.20160915 2023-11-07 16:18:44,408 4840 [DEBUG] - KB2999226 1.0.20181019 2023-11-07 16:18:44,408 4840 [DEBUG] - KB3033929 1.0.5 2023-11-07 16:18:44,424 4840 [DEBUG] - KB3035131 1.0.3 2023-11-07 16:18:44,424 4840 [DEBUG] - KB3063858 1.0.0 2023-11-07 16:18:44,424 4840 [DEBUG] - NexuShell 1.0.0 2023-11-07 16:18:44,424 4840 [DEBUG] - nexus-repository 3.60.0.2 2023-11-07 16:18:44,440 4840 [DEBUG] - sql-server-express 2022.16.0.1000 2023-11-07 16:18:44,440 4840 [DEBUG] - Temurin11jre 11.0.21.900 2023-11-07 16:18:44,440 4840 [DEBUG] - vcredist140 14.36.32532 2023-11-07 16:18:44,534 4840 [DEBUG] - [Background] Configuring background service. 2023-11-07 16:18:44,534 4840 [DEBUG] - [Background] Not using background service, user is administrator. 2023-11-07 16:18:44,549 4840 [DEBUG] - Performing validation checks. 2023-11-07 16:18:44,549 4840 [DEBUG] - Global Configuration Validation Checks: 2023-11-07 16:18:44,549 4840 [DEBUG] - - Package Exit Code / Exit On Reboot = Checked 2023-11-07 16:18:44,549 4840 [DEBUG] - System State Validation Checks: 2023-11-07 16:18:44,549 4840 [DEBUG] - Reboot Requirement Checks: 2023-11-07 16:18:44,565 4840 [DEBUG] - - Pending Computer Rename = Checked 2023-11-07 16:18:44,565 4840 [DEBUG] - - Pending Component Based Servicing = Checked 2023-11-07 16:18:44,565 4840 [DEBUG] - - Pending Windows Auto Update = Checked 2023-11-07 16:18:44,565 4840 [DEBUG] - - Pending File Rename Operations = Ignored 2023-11-07 16:18:44,565 4840 [DEBUG] - - Pending Windows Package Installer = Checked 2023-11-07 16:18:44,565 4840 [DEBUG] - - Pending Windows Package Installer SysWow64 = Checked 2023-11-07 16:18:44,565 4840 [DEBUG] - Cache Folder Lockdown Checks: 2023-11-07 16:18:44,580 4840 [DEBUG] - - Elevated State = Checked 2023-11-07 16:18:44,580 4840 [DEBUG] - - Folder Exists = Checked 2023-11-07 16:18:44,580 4840 [DEBUG] - - Folder lockdown = Checked 2023-11-07 16:18:44,596 4840 [DEBUG] - The source '' evaluated to a 'normal' source type 2023-11-07 16:18:44,612 4840 [DEBUG] - NOTE: Hiding sensitive configuration data! Please double and triple check to be sure no sensitive data is shown, especially if copying output to a gist for review. 2023-11-07 16:18:44,643 4840 [DEBUG] - Configuration: MaximumDownloadRateBitsPerSecond='0'| MaximumDownloadRateBitsPerSecondAutoSet='False'| LicensedInformation.LicenseType='Business'| LicensedInformation.LicenseIsValid='True'| LicensedInformation.LicenseIsTrial='False'| LicensedInformation.PauseInTrial='False'| LicensedInformation.LicenseUserName='James Ruskin [100] (james[at REDACTED])'| LicensedInformation.LicenseExpirationDate='05/05/2024 00:00:00'| LicensedInformation.LicenseNodeCount='100'| LicensedInformation.LicensedVersion='6.1.0.0'| ChocolateyVersion.Version='2.2.2.0'| ChocolateyVersion.IsLegacyVersion='False'| ChocolateyVersion.Revision='0'|ChocolateyVersion.IsSemVer2='False'| ChocolateyVersion.OriginalVersion='2.2.2.0'| ChocolateyVersion.Major='2'| ChocolateyVersion.Minor='2'|ChocolateyVersion.Patch='2'| ChocolateyVersion.IsPrerelease='False'| ChocolateyVersion.HasMetadata='False'| LicensedFeatures.UseDownloadCache='True'| LicensedFeatures.AllowSynchronization='True'| LicensedFeatures.AllowBackgroundServiceOverride='False'| LicensedFeatures.UseBackgroundService='False'| LicensedFeatures.UseBackgroundServiceWithSelfServiceSourcesOnly='True'| LicensedFeatures.UseBackgroundServiceWithNonAdministratorsOnly='True'| LicensedFeatures.UseBackgroundServiceInteractively='False'| LicensedFeatures.UseBackgroundServiceWithEmptySessions='True'| LicensedFeatures.AllowBackgroundServiceUninstallsFromUserInstallsOnly='True'| LicensedFeatures.AllowPreviewFeatures='False'| LicensedFeatures.ShowAllPackagesInProgramsAndFeatures='False'| LicensedFeatures.AdminOnlyExecutionForAllChocolateyCommands='False'| LicensedFeatures.AdminOnlyExecutionForNewCommand='False'| LicensedFeatures.AdminOnlyExecutionForDownloadCommand='False'| LicensedFeatures.ReduceInstalledPackageSize='True'| LicensedFeatures.ReduceOnlyNupkgSize='False'| LicensedFeatures.UseLocalSystemForServiceInstalls='True'| LicensedFeatures.WarnOnUpcomingLicenseExpiration='True'| LicensedFeatures.UseChocolateyCentralManagement='True'| LicensedFeatures.UseChocolateyCentralManagementDeployments='True'| LicensedFeatures.UseLogRetentionPolicy='True'| LicensedFeatures.ExcludeChocolateyPackagesDuringUpgradeAll='True'| LicensedNewCommand.UseOriginalFilesLocation='False'| LicensedNewCommand.PauseOnError='False'| LicensedNewCommand.BuildPackage='False'| LicensedNewCommand.GeneratePackagesFromSoftwareInstalls='False'| LicensedNewCommand.IncludeArchitectureInPackageId='False'| LicensedDownloadCommand.Internalize='False'| LicensedDownloadCommand.AppendUseOriginalLocation='True'| LicensedDownloadCommand.InternalizeAnyUrlFound='False'| LicensedDownloadCommand.DownloadInstalledPackages='False'| LicensedDownloadCommand.IgnoreUnfoundPackages='False'| LicensedConvertCommand.IncludeAll='False'| LicensedConvertCommand.IncludeDependencies='False'| LicensedPushCommand.IntuneAuthenticationUrl='https://login.microsoftonline.com'| LicensedPushCommand.IntuneApiUrl='https://graph.microsoft.com'| LicensedPushCommand.IntuneRetryIntervalInSeconds='5'| LicensedPushCommand.IntuneUploadTimeoutInSeconds='600'| LicensedPushCommand.IntuneUploadChunkSizeInMegabytes='10'| LicensedPushCommand.SkipCleanup='False'| LicensedListCommand.ShowAuditInformation='False'| LicensedListCommand.ShowDisplayVersion='False'| LicensedUninstallCommand.FromProgramsAndFeatures='False'| VirusConfiguration.VirusCheckMinimumPositives='4'| VirusConfiguration.VirusScannerType='Generic'| VirusConfiguration.GenericVirusScannerArgs=''[[File]]''| VirusConfiguration.GenericVirusScannerValidExitCodes='0'| VirusConfiguration.GenericVirusScannerTimeoutInSeconds='120'| LicensedServiceInstaller.DefaultUserName='ChocolateyLocalAdmin'| CentralManagementConfiguration.ReportPackagesTimerIntervalInSeconds='1800'| CentralManagementConfiguration.ServiceUrl='https://demo1.ch0.co:24020/ChocolateyManagementService'| CentralManagementConfiguration.ReceiveTimeoutInSeconds='30'| CentralManagementConfiguration.SendTimeoutInSeconds='30'| CentralManagementConfiguration.CertificateValidationMode='PeerOrChainTrust'| CentralManagementConfiguration.MaxReceiveMessageSizeInBytes='2147483647'| CentralManagementConfiguration.DeploymentCheckTimerIntervalInSeconds='180'| LicensedBackgroundService.LogRetentionPolicyInDays='30'| CommandName='install'| CacheLocation='C:\ProgramData\chocolatey\choco-cache'| CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'| SourceType='normal'|ShowOnlineHelp='False'|Debug='False'| Verbose='False'|Trace='False'|Force='False'|Noop='False'| HelpRequested='False'|UnsuccessfulParsing='False'| RegularOutput='False'| QuietOutput='False'|PromptForConfirmation='False'| DisableCompatibilityChecks='False'|AcceptLicense='True'| AllowUnofficialBuild='False'| Input='package_does_not_exist --fail-on-unfound'|AllVersions='False'| SkipPackageInstallProvider='False'|SkipHookScripts='False'| PackageNames='package_does_not_exist'|Prerelease='False'| ForceX86='False'|OverrideArguments='False'|NotSilent='False'| ApplyPackageParametersToDependencies='False'| ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'| CacheExpirationInMinutes='30'|AllowDowngrade='False'| ForceDependencies='False'|PinPackage='False'| Information.PlatformType='Windows'| Information.PlatformVersion='10.0.17763.0'| Information.PlatformName='Windows Server 2016'| Information.ChocolateyVersion='2.2.2.0'| Information.ChocolateyProductVersion='2.2.2'| Information.FullName='choco, Version=2.2.2.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'| Information.Is64BitOperatingSystem='True'| Information.Is64BitProcess='True'|Information.IsInteractive='False'| Information.UserName='Administrator'| Information.UserDomainName='WIN-R4URNF4DQFQ'| Information.IsUserAdministrator='True'| Information.IsUserSystemAccount='False'| Information.IsUserRemoteDesktop='False'| Information.IsUserRemote='True'| Information.IsProcessElevated='True'| Information.IsLicensedVersion='True'| Information.IsLicensedAssemblyLoaded='True'| Information.LicenseType='Business'| Information.CurrentDirectory='C:\Users\Administrator'| Features.AutoUninstaller='True'|Features.ChecksumFiles='True'| Features.AllowEmptyChecksums='False'| Features.AllowEmptyChecksumsSecure='True'| Features.FailOnAutoUninstaller='False'| Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'| Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'| Features.VirusCheck='False'| Features.FailOnInvalidOrMissingLicense='False'| Features.IgnoreInvalidOptionsSwitches='True'| Features.UsePackageExitCodes='True'| Features.UseEnhancedExitCodes='False'| Features.UseFipsCompliantChecksums='False'| Features.ShowNonElevatedWarnings='False'| Features.ShowDownloadProgress='False'| Features.StopOnFirstPackageFailure='False'| Features.UseRememberedArgumentsForUpgrades='False'| Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'| Features.SkipPackageUpgradesWhenNotInstalled='True'| Features.RemovePackageInformationOnUninstall='False'| Features.ExitOnRebootDetected='False'| Features.LogValidationResultsOnWarnings='True'| Features.UsePackageRepositoryOptimizations='True'| ListCommand.LocalOnly='False'|ListCommand.IdOnly='False'| ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'| ListCommand.Exact='False'|ListCommand.ByIdOnly='False'| ListCommand.ByTagOnly='False'|ListCommand.IdStartsWith='False'| ListCommand.OrderByPopularity='False'|ListCommand.ApprovedOnly='False'| ListCommand.DownloadCacheAvailable='False'| ListCommand.NotBroken='False'| ListCommand.IncludeVersionOverrides='False'| ListCommand.ExplicitPageSize='False'| ListCommand.ExplicitSource='False'| UpgradeCommand.FailOnUnfound='False'| UpgradeCommand.FailOnNotInstalled='False'| UpgradeCommand.NotifyOnlyAvailableUpgrades='False'| UpgradeCommand.ExcludePrerelease='False'| NewCommand.AutomaticPackage='False'| NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'| SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'| SourceCommand.AllowSelfService='False'| SourceCommand.VisibleToAdminsOnly='False'| FeatureCommand.Command='unknown'|ConfigCommand.Command='Unknown'| ApiKeyCommand.Command='Unknown'|PinCommand.Command='Unknown'| OutdatedCommand.IgnorePinned='False'| ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'| TemplateCommand.Command='unknown'|CacheCommand.Command='Unknown'| CacheCommand.RemoveExpiredItemsOnly='False'| 2023-11-07 16:18:44,643 4840 [DEBUG] - _ Chocolatey:ProChocolateyInstallCommand - Normal Run Mode _ 2023-11-07 16:18:44,643 4840 [INFO ] - Installing the following packages: 2023-11-07 16:18:44,659 4840 [INFO ] - package_does_not_exist 2023-11-07 16:18:44,659 4840 [ERROR] - Installation was NOT successful. There are no sources enabled for packages, and none were passed as arguments. 2023-11-07 16:18:44,659 4840 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers... 2023-11-07 16:18:44,659 4840 [DEBUG] - [Countdown] Determining how long until license expires 2023-11-07 16:18:44,674 4840 [DEBUG] - chocolatey 2.2.2 2023-11-07 16:18:44,674 4840 [DEBUG] - chocolatey.extension 6.1.0 2023-11-07 16:18:44,690 4840 [DEBUG] - chocolatey-agent 2.1.0 2023-11-07 16:18:44,690 4840 [DEBUG] - chocolatey-compatibility.extension 1.0.0 2023-11-07 16:18:44,690 4840 [DEBUG] - chocolatey-core.extension 1.4.0 2023-11-07 16:18:44,690 4840 [DEBUG] - chocolatey-licensed-jenkins-scripts 0.1.1 2023-11-07 16:18:44,690 4840 [DEBUG] - chocolatey-management-database 0.11.0 2023-11-07 16:18:44,690 4840 [DEBUG] - chocolatey-management-service 0.11.0 2023-11-07 16:18:44,706 4840 [DEBUG] - chocolatey-management-web 0.11.0 2023-11-07 16:18:44,706 4840 [DEBUG] - chocolatey-windowsupdate.extension 1.0.5 2023-11-07 16:18:44,706 4840 [DEBUG] - dbatools 2.1.4 2023-11-07 16:18:44,706 4840 [DEBUG] - dbatools-library.powershell 2023.9.21 2023-11-07 16:18:44,706 4840 [DEBUG] - dotnet-6.0-aspnetruntime 6.0.24 2023-11-07 16:18:44,706 4840 [DEBUG] - dotnet-6.0-runtime 6.0.24 2023-11-07 16:18:44,721 4840 [DEBUG] - dotnet-aspnetcoremodule-v2 16.0.23237 2023-11-07 16:18:44,721 4840 [DEBUG] - jenkins 2.414.3 2023-11-07 16:18:44,721 4840 [DEBUG] - KB2919355 1.0.20160915 2023-11-07 16:18:44,721 4840 [DEBUG] - KB2919442 1.0.20160915 2023-11-07 16:18:44,721 4840 [DEBUG] - KB2999226 1.0.20181019 2023-11-07 16:18:44,721 4840 [DEBUG] - KB3033929 1.0.5 2023-11-07 16:18:44,721 4840 [DEBUG] - KB3035131 1.0.3 2023-11-07 16:18:44,737 4840 [DEBUG] - KB3063858 1.0.0 2023-11-07 16:18:44,737 4840 [DEBUG] - NexuShell 1.0.0 2023-11-07 16:18:44,737 4840 [DEBUG] - nexus-repository 3.60.0.2 2023-11-07 16:18:44,737 4840 [DEBUG] - sql-server-express 2022.16.0.1000 2023-11-07 16:18:44,737 4840 [DEBUG] - Temurin11jre 11.0.21.900 2023-11-07 16:18:44,737 4840 [DEBUG] - vcredist140 14.36.32532 2023-11-07 16:18:44,784 4840 [DEBUG] - [Programs & Features Package Sync] Ensuring all installed packages that don't have software natively installed are not listed in Programs and Features. 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey 2.2.2 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey.extension 6.1.0 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey-agent 2.1.0 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey-compatibility.extension 1.0.0 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey-core.extension 1.4.0 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey-licensed-jenkins-scripts 0.1.1 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey-management-database 0.11.0 2023-11-07 16:18:44,799 4840 [DEBUG] - chocolatey-management-service 0.11.0 2023-11-07 16:18:44,815 4840 [DEBUG] - chocolatey-management-web 0.11.0 2023-11-07 16:18:44,815 4840 [DEBUG] - chocolatey-windowsupdate.extension 1.0.5 2023-11-07 16:18:44,815 4840 [DEBUG] - dbatools 2.1.4 2023-11-07 16:18:44,815 4840 [DEBUG] - dbatools-library.powershell 2023.9.21 2023-11-07 16:18:44,815 4840 [DEBUG] - dotnet-6.0-aspnetruntime 6.0.24 2023-11-07 16:18:44,831 4840 [DEBUG] - dotnet-6.0-runtime 6.0.24 2023-11-07 16:18:44,831 4840 [DEBUG] - dotnet-aspnetcoremodule-v2 16.0.23237 2023-11-07 16:18:44,831 4840 [DEBUG] - jenkins 2.414.3 2023-11-07 16:18:44,831 4840 [DEBUG] - KB2919355 1.0.20160915 2023-11-07 16:18:44,831 4840 [DEBUG] - KB2919442 1.0.20160915 2023-11-07 16:18:44,831 4840 [DEBUG] - KB2999226 1.0.20181019 2023-11-07 16:18:44,831 4840 [DEBUG] - KB3033929 1.0.5 2023-11-07 16:18:44,846 4840 [DEBUG] - KB3035131 1.0.3 2023-11-07 16:18:44,846 4840 [DEBUG] - KB3063858 1.0.0 2023-11-07 16:18:44,846 4840 [DEBUG] - NexuShell 1.0.0 2023-11-07 16:18:44,846 4840 [DEBUG] - nexus-repository 3.60.0.2 2023-11-07 16:18:44,846 4840 [DEBUG] - sql-server-express 2022.16.0.1000 2023-11-07 16:18:44,846 4840 [DEBUG] - Temurin11jre 11.0.21.900 2023-11-07 16:18:44,846 4840 [DEBUG] - vcredist140 14.36.32532 2023-11-07 16:18:44,893 4840 [DEBUG] - Exiting with 1 ~~~

Additional Context

Workarounds

  1. Run Chocolatey CLI manually without using win_chocolatey, if you want to use the feature, e.g.:
    
    - name: Enable Chocolatey Feature to skip not installed packages
    win_chocolatey_feature:
    name: skipPackageUpgradesWhenNotInstalled
    state: enabled
  1. Write playbook logic to calculate which packages to upgrade, based on chocolatey_facts, e.g.:
    
    - name: Get Chocolatey Data
    chocolatey.chocolatey.win_chocolatey_facts:

Notes and Findings

Proposed Solution

  1. We should either ensure that we run upgrade instead of install when the state is set to upgrade, or otherwise respect the features we support in the CLI before interpreting the state.
    a. Checking the feature could be "costly" in comparison to calling upgrade when state is upgrade, but there may be another reason we install missing packages regardless of some states?

Related Issues and Tickets

/cc @JPRuskin