GithubHelp home page GithubHelp logo

puppetlabs / puppetlabs-chocolatey Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chocolatey-archive/puppet-chocolatey

17.0 104.0 65.0 1.07 MB

Chocolatey Package Provider for Puppet

License: Apache License 2.0

Ruby 96.67% Puppet 3.04% PowerShell 0.19% Dockerfile 0.10%
module supported hacktoberfest

puppetlabs-chocolatey's Introduction

chocolatey

Chocolatey for Business Now Available!

We're excited for you to learn more about what's available in the Business editions!

Table of Contents

  1. Overview
  2. Module Description - What the chocolatey module does and why it is useful
  3. Setup - The basics of getting started with chocolatey
  4. Usage - Configuration options and additional functionality
  5. Reference
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module
  8. License
  9. Attributions

Overview

This is a Puppet package provider for Chocolatey, which is like apt-get, but for Windows. Check the module's metadata.json for compatible Puppet and Puppet Enterprise versions.

Module Description

This is the official module for working with the Chocolatey package manager. There are two versions available:

  • puppetlabs/chocolatey
    • This is the stable version and is commercially supported by Puppet.
    • It is slower moving, but offers greater stability and fewer changes.
  • chocolatey/chocolatey
    • This is the bleeding edge version and is not commercially supported by Puppet.
    • It keeps up with all the new features, but is not as fully tested.

This module supports all editions of Chocolatey, including FOSS, Professional and Chocolatey for Business.

This module is able to:

  • Install Chocolatey
  • Work with custom location installations
  • Configure Chocolatey
  • Use Chocolatey as a package provider

Why Chocolatey

Chocolatey closely mimics how package managers on other operating systems work. If you can imagine the built-in provider for Windows versus Chocolatey, take a look at the use case of installing git:

# Using built-in provider
package { "Git version 1.8.4-preview20130916":
  ensure    => installed,
  source    => 'C:\temp\Git-1.8.4-preview20130916.exe',
  install_options => ['/VERYSILENT']
}
# Using Chocolatey (set as default for Windows)
package { 'git':
  ensure   => latest,
}

With the built-in provider:

With Chocolatey's provider:

  • The package name only has to match the name of the package, which can be whatever you choose.
  • The package knows how to install the software silently.
  • The package knows where to get the executable installer.
  • The source is able to specify different Chocolatey feeds.
  • Chocolatey makes package more platform agnostic, because it looks exactly like other platforms.

For reference, read about the provider features available from the built-in provider, compared to other package managers:

Provider holdable install options installable package settings purgeable reinstallable uninstall options uninstallable upgradeable versionable virtual packages
Windows x x x x x
Chocolatey x x x x x x x
apt x x x x x x x
yum x x x x x x x

Setup

What Chocolatey affects

Chocolatey affects your system and what software is installed on it, ranging from tools and portable software, to natively installed applications.

Setup Requirements

Chocolatey requires the following components:

  • Powershell v2+ (Installed on most systems by default)
  • .NET Framework v4+

Beginning with Chocolatey provider

Install this module via any of these approaches:

Usage

Manage Chocolatey installation

Ensure Chocolatey is installed and configured:

include chocolatey

Override default Chocolatey install location

class {'chocolatey':
  choco_install_location => 'D:\secured\choco',
}

NOTE: This will affect suitability on first install. There are also special considerations for C:\Chocolatey as an install location, see choco_install_location for details.

Use an internal chocolatey.nupkg for Chocolatey installation

class {'chocolatey':
  chocolatey_download_url         => 'https://internalurl/to/chocolatey.nupkg',
  use_7zip                        => false,
  choco_install_timeout_seconds   => 2700,
}

Use a file chocolatey.0.9.9.9.nupkg for installation

class {'chocolatey':
  chocolatey_download_url         => 'file:///c:/location/of/chocolatey.0.9.9.9.nupkg',
  use_7zip                        => false,
  choco_install_timeout_seconds   => 2700,
}

Specify the version of chocolatey by class parameters

class {'chocolatey':
  chocolatey_download_url         => 'file:///c:/location/of/chocolatey.0.9.9.9.nupkg',
  use_7zip                        => false,
  choco_install_timeout_seconds   => 2700,
  chocolatey_version              => '0.9.9.9',
}

Log chocolatey bootstrap installer script output

class {'chocolatey':
  log_output              => true,
}

Install chocolatey using a proxy server

class {'chocolatey':
  install_proxy => 'http://proxy.megacorp.com:3128',
}

Configuration

If you have Chocolatey 0.9.9.x or above, you can take advantage of configuring different aspects of Chocolatey.

Sources Configuration

You can specify sources that Chocolatey uses by default, along with priority.

Requires Chocolatey v0.9.9.0+.

Disable the default community repository source
chocolateysource {'chocolatey':
  ensure => disabled,
}
Set a priority on a source
chocolateysource {'chocolatey':
  ensure   => present,
  location => 'https://chocolatey.org/api/v2',
  priority => 1,
}
Add credentials to a source
chocolateysource {'sourcename':
  ensure   => present,
  location => 'https://internal/source',
  user     => 'username',
  password => 'password',
}

NOTE: Chocolatey encrypts the password in a way that is not verifiable. If you need to rotate passwords, you cannot use this resource to do so unless you also change the location, user, or priority (because those are ensurable properties).

NOTE: The sensitive password can be deferred using the Deferred function on Puppet Master and enable to execute on agent.

chocolateysource {'sourcename':
  ensure   => present,
  location => 'https://internal/source',
  user     => 'username',
  password => Deferred('sprintf', ['password']),
}

Features Configuration

You can configure features that Chocolatey has available. Run choco feature list to see the available configuration features.

Requires Chocolatey v0.9.9.0+.

Enable Auto Uninstaller

Uninstall from Programs and Features without requiring an explicit uninstall script.

chocolateyfeature {'autouninstaller':
  ensure => enabled,
}
Disable Use Package Exit Codes

Requires 0.9.10+ for this feature.

Use Package Exit Codes - Allows package scripts to provide exit codes. With this enabled, Chocolatey uses package exit codes for exit when non-zero (this value can come from a dependency package). Chocolatey defines valid exit codes as 0, 1605, 1614, 1641, 3010. With this feature disabled, Chocolatey exits with a 0 or a 1 (matching previous behavior).

Note that this behavior may cause Puppet to think that the run has failed. We advise that you leave this at the default setting or disable it. Do not enable it.

chocolateyfeature {'usepackageexitcodes':
  ensure => disabled,
}
Enable Virus Check

Requires 0.9.10+ and Chocolatey Pro / Business for this feature.

Virus Check - Performs virus checking on downloaded files. (Licensed versions only.)

chocolateyfeature {'viruscheck':
  ensure => enabled,
}
Enable FIPS Compliant Checksums

Requires 0.9.10+ for this feature.

Use FIPS Compliant Checksums - Ensures checksumming done by Chocolatey uses FIPS compliant algorithms. Not recommended unless required by FIPS Mode. Enabling on an existing installation could have unintended consequences related to upgrades or uninstalls.

chocolateyfeature {'usefipscompliantchecksums':
  ensure => enabled,
}

Config configuration

You can configure config values that Chocolatey has available. Run choco config list to see the config settings available (just the config settings section).

Requires Chocolatey v0.9.10.0+.

Set cache location

The cache location defaults to the TEMP directory. You can set an explicit directory to cache downloads to instead of the default.

chocolateyconfig {'cachelocation':
  value  => "c:\\downloads",
}
Unset cache location

Removes cache location setting, returning the setting to its default.

chocolateyconfig {'cachelocation':
  ensure => absent,
}
Use an explicit proxy

When using Chocolatey behind a proxy, set proxy and optionally proxyUser and proxyPassword.

NOTE: The proxyPassword value is not verifiable.

chocolateyconfig {'proxy':
  value  => 'https://someproxy.com',
}

chocolateyconfig {'proxyUser':
  value  => 'bob',
}

# not verifiable
chocolateyconfig {'proxyPassword':
  value  => 'securepassword',
}

NOTE: The sensitive value can be deferred using the Deferred function on Puppet Master and enable to execute on agent.

chocolateyconfig {'proxyPassword':
  value  => Deferred('sprintf', ['securepassword']),
}

Set Chocolatey as Default Windows Provider

If you want to set this provider as the site-wide default, add to your site.pp:

if $::kernel == 'windows' {
  Package { provider => chocolatey, }
}

# OR

case $operatingsystem {
  'windows': {
    Package { provider => chocolatey, }
  }
}

Packages

With all options

package { 'notepadplusplus':
  ensure            => installed|latest|'1.0.0'|'>=1.0 <2.0'|absent,
  provider          => 'chocolatey',
  install_options   => ['-pre','-params','"','param1','param2','"'],
  uninstall_options => ['-r'],
  source            => 'https://myfeed.example.com/api/v2',
  package_settings  => { 'verbose' => true, 'log_output' => true, },
}
  • Supports installable and uninstallable.
  • Supports versionable so that ensure => '1.0' works.
  • Supports version_range so that ensure => '>=1.0 <2.0' works.
  • Supports upgradeable.
  • Supports latest (checks upstream), absent (uninstall).
  • Supports install_options for pre-release, and other command-line options.
  • Supports uninstall_options for pre-release, and other command-line options.
  • Supports holdable, requires Chocolatey v0.9.9.0+.
  • Uses package_settings to pass flags to the chocolatey provider.

Simple install

package { 'notepadplusplus':
  ensure   => installed,
  provider => 'chocolatey',
}

To always ensure using the newest version available

package { 'notepadplusplus':
  ensure   => latest,
  provider => 'chocolatey',
}

To ensure a specific version

package { 'notepadplusplus':
  ensure   => '6.7.5',
  provider => 'chocolatey',
}

To ensure a version range

package { 'notepadplusplus':
  ensure   => '>=6.7.5 <7.0',
  provider => 'chocolatey',
}

To specify custom source

package { 'notepadplusplus':
  ensure   => '6.7.5',
  provider => 'chocolatey',
  source   => 'C:\local\folder\packages',
}
package { 'notepadplusplus':
  ensure   => '6.7.5',
  provider => 'chocolatey',
  source   => '\\unc\source\packages',
}
package { 'notepadplusplus':
  ensure   => '6.7.5',
  provider => 'chocolatey',
  source   => 'https://custom.nuget.odata.feed/api/v2/',
}
package { 'notepadplusplus':
  ensure   => '6.7.5',
  provider => 'chocolatey',
  source   => 'C:\local\folder\packages;https://chocolatey.org/api/v2/',
}

Install options with spaces

Spaces in arguments must always be covered with a separation. Shown below is an example of how you configure -installArgs "/VERYSILENT /NORESTART".

package {'launchy':
  ensure          => installed,
  provider        => 'chocolatey',
  install_options => ['-override', '-installArgs', '"', '/VERYSILENT', '/NORESTART', '"'],
}

Install options with quotes or spaces

The underlying installer may need quotes passed to it. This is possible, but not as intuitive. The example below covers passing /INSTALLDIR="C:\Program Files\somewhere".

For this to be passed through with Chocolatey, you need a set of double quotes surrounding the argument and two sets of double quotes surrounding the item that must be quoted (see how to pass/options/switches). This makes the string look like -installArgs "/INSTALLDIR=""C:\Program Files\somewhere""" for proper use with Chocolatey.

Then, for Puppet to handle that appropriately, you must split on every space. Yes, on every space you must split the string or the result comes out incorrectly. This means it will look like the following:

install_options => ['-installArgs',
  '"/INSTALLDIR=""C:\Program', 'Files\somewhere"""']

Make sure you have all of the right quotes - start it off with a single double quote, then two double quotes, then close it all by closing the two double quotes and then the single double quote or a possible three double quotes at the end.

package {'mysql':
  ensure          => latest,
  provider        => 'chocolatey',
  install_options => ['-override', '-installArgs',
    '"/INSTALLDIR=""C:\Program', 'Files\somewhere"""'],
}

You can split it up a bit for readability if it suits you:

package {'mysql':
  ensure          => latest,
  provider        => 'chocolatey',
  install_options => ['-override', '-installArgs', '"'
    '/INSTALLDIR=""C:\Program', 'Files\somewhere""',
    '"'],
}

Note: The above is for Chocolatey v0.9.9+. You may need to look for an alternative method to pass args if you have 0.9.8.x and below.

A warning about secrets in install_options

There is no guarantee that secrets in install_options will not show up in debug runs of either puppet agent or puppet apply calls.

This is another reason to not set your production runs to debug mode.

However, this information is not written to puppetdb or any other Puppet logs.

It is written to the Chocolatey log on each machine unless you have C4B and use the --package-parameters-sensitive or --install-arguments-sensitive Chocolatey parameters, which will redact specified values from the Chocolatey log.

For more information on these Chocolatey parameters, see the Chocolatey reference documentation on the install command and the upgrade command.

If you need to include a secret in your install_options, do not run in debug mode in production and use C4B and the --package-parameters-sensitive or --install-arguments-sensitive Chocolatey parameter.

Passing Flags With Package Settings

You can pass flags to the chocolatey provider using package_settings. You might want to do this in a default:

    Package {
      package_settings => { 'verbose' => true, 'log_output' => true, },
    }
  • "verbose" causes calls to chocolatey to output information about what they're about to do; this is because some things, in particular "ensure => latest", are pretty slow, which can lead to long periods where Puppet appears to be doing nothing.
    • When Chocolatey is version 0.10.4 or later and "Verbose" is not specified as true Chocolatey will be run with the --no-progress parameter, limiting the erroneous output of download information to the logs.
  • "log_output" causes the output of chocolatey upgrades and installs to be shown.

Reference

For information on classes and types, see REFERENCE.md. For information on facts, see below.

Facts

  • chocolateyversion - The version of the installed Chocolatey client (could also be informationally provided by class parameter chocolatey_version).
  • choco_install_path - The location of the installed Chocolatey client (could also be provided by class parameter choco_install_location).

Limitations

  • The module is only suppported on Windows. For an extensive list of supported operating systems, see metadata.json
  • If you override an existing install location of Chocolatey using choco_install_location => in the Chocolatey class, it does not bring any of the existing packages with it. You will need to handle that through some other means.
  • Overriding the install location will also not allow Chocolatey to be configured or install packages on the same run that it is installed on. See choco_install_location for details.

Known Issues

  • This module doesn't support side by side scenarios.
  • This module may have issues upgrading Chocolatey itself using the package resource.
  • If .NET 4.0 is not installed, it may have trouble installing Chocolatey. Chocolatey version 0.9.9.9+ helps alleviate this issue.
  • If there is an error in the installer (InstallChocolatey.ps1.erb), it may not show as an error. This may be an issue with the PowerShell provider and is still under investigation.

License

This codebase is licensed under the Apache2.0 licensing, however due to the nature of the codebase the open source dependencies may also use a combination of AGPL, BSD-2, BSD-3, GPL2.0, LGPL, MIT and MPL Licensing.

Development

Acceptance tests for this module leverage puppet_litmus. To run the acceptance tests follow the instructions here. You can also find a tutorial and walkthrough of using Litmus and the PDK on YouTube.

If you run into an issue with this module, or if you would like to request a feature, please file a ticket. Every Monday the Puppet IA Content Team has office hours in the Puppet Community Slack, alternating between an EMEA friendly time (1300 UTC) and an Americas friendly time (0900 Pacific, 1700 UTC).

If you have problems getting this module up and running, please contact Support.

If you submit a change to this module, be sure to regenerate the reference documentation as follows:

puppet strings generate --format markdown --out REFERENCE.md

Attributions

A special thanks goes out to Rich Siegel and Rob Reynolds who wrote the original provider and continue to contribute to the development of this provider.

puppetlabs-chocolatey's People

Contributors

adrianiurca avatar chelnak avatar clairecadman avatar daianamezdrea avatar david22swan avatar davids avatar eimlav avatar empi89 avatar eputnam avatar ferventcoder avatar glennsarti avatar gspatton avatar hunner avatar jordanbreen28 avatar jpogran avatar jumanjiman avatar lionce avatar lukasaud avatar malikparvez avatar michaeltlombardi avatar mosesmendoza avatar pmcmaw avatar rajat-puppet avatar ramesh7 avatar randomnoun7 avatar rismoney avatar sanfrancrisko avatar sheenaajay avatar smortex avatar tphoney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppetlabs-chocolatey's Issues

Illegal characters in path error when using Sensitive data type

Describe the Bug

Using Sensitive data type in package resource declaration causes an Illegal characters in path error

Expected Behavior

Sensitive should be an acceptable type because users may wish to redact items such as passwords from Puppet logs and reports

Steps to Reproduce

Create a resource declaration and create a Sensitive value such as for a password

  $foo = 'username'
  $bar = Sensitive('password')
  package {'<package>':
    ensure => latest,
    install_options => ['--pre', "--parameters=\'/Username:${foo}\'", "--package-parameters-sensitive=\'/Password:${bar}\'",],
    provider => chocolatey,
    }

Puppet run on the agent node results in Illegal characters in path. (corrective) Notice: Applied catalog in 19.47 seconds

Environment

  • Version 6.1.0
  • Platform (primary server: Ubuntu 18.04, agent: Windows Server 2019)

choco update is deprecated

Describe the Bug

Chocolatey provider issues deprecation warning for update command:

DEPRECATION NOTICE - choco update is deprecated and will be removed or 
 replaced in version 1.0.0 with something that performs the functions 
 of updating package indexes. Please use `choco upgrade` instead.

Expected Behavior

A clear and concise description of what you expected to happen.

Steps to Reproduce

Steps to reproduce the behavior:

Run choco update

Environment

Module Version: 6.0.1
Puppet Version: 8.26.0
OS Name/Version: Windows
Chocolatey v0.12.1 Business

Additional Context

Running Chocolatey V 1.0.0+ you get the following error if trying to run an update:

Could not find a command registered that meets 'update'.

Try choco -? for command reference/help.

Clarification on version range

Hello,
according to this article, the provider should always install the latest version within a specified range but my tests demonstrate that this is not the case.

For example, given

  • a range '>=6.7.5 <7.0'
  • following available package versions: 6.7.5, 6.7.6, 7.0
  • the module
 package { 'notepadplusplus':
  ensure   => '>=6.7.5 <7.0',
  provider => 'chocolatey',
}

If the current installed version is the 6.7.5, I would expect the provider to update the package to the 6.7.6 version but this is not happening, the provider keeps the 6.7.5 package version.

Is that the expected behavior?

Thanks

Error while running on a Linux client

Describe the Bug

We are using a puppet server to manage Windows and Linux clients.

Since, chocolatey module has been installed, we have warnings on Linux clients (not fatal)

Error: Could not autoload puppet/provider/package/chocolatey: cannot load such file -- rexml/document
Error: Facter: error while resolving custom facts in /var/lib/puppet/lib/facter/package_provider.rb Could not autoload puppet/provider/package/chocolatey: cannot load such file -- rexml/document
puppetserver   7.9.2-1bullseye
puppetlabs-chocolatey (v7.0.1)

Version compatibility table is inaccurate

Describe the Bug

In version 6.1.0 of puppetlabs-chocolately, support for version range was added (1a3dc2c). This increased the minimum Puppet version to 6.15 (PUP-10357). Therefore, for 6.1.0 and newer of the module the minimum compatibility should be increased to Puppet >= 6.15 and PE >= 2019.8.x

Unknown resource type: 'registry_value'

Describe the Bug

When I attempt to use the puppet agent, I receive the following:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'registry_value' (file: /etc/puppetlabs/code/environments/production/modules/chocolatey/manifests/install.pp, line: 38, column: 3) on node desktop-pmmjds3.wftigers.org C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/rest.rb:48:in rescue in find'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/rest.rb:9:in find' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:230:in find'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:731:in block in retrieve_new_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util.rb:518:in block in thinmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/3.2.0/benchmark.rb:311:in realtime' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util.rb:517:in thinmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:730:in retrieve_new_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:84:in retrieve_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:269:in prepare_and_retrieve_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:430:in run_internal'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:341:in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:85:in block (6 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet.rb:288:in override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:84:in block (5 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/3.2.0/timeout.rb:189:in block in timeout'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/3.2.0/timeout.rb:196:in timeout' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:83:in block (4 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:23:in lock' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:73:in block (3 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:164:in with_client' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:69:in block (2 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:129:in run_in_fork' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:68:in block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application.rb:174:in controlled_run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:49:in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:437:in onetime' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:394:in block in run_command'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet.rb:288:in override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:391:in run_command' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application.rb:423:in block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util.rb:706:in exit_on_fail' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application.rb:423:in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:145:in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:79:in execute'
C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:5:in <main>' Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

I have the registry module installed.

`puppet module list --environment production

/etc/puppetlabs/code/environments/production/site-modules
├── adhoc (???)
├── profile (???)
└── role (???)
/etc/puppetlabs/code/environments/production/modules
├── puppetlabs-acl (v5.0.0)
├── puppetlabs-apt (v9.4.0)
├── puppetlabs-chocolatey (v8.0.0)
├── puppetlabs-concat (v9.0.2)
├── puppetlabs-facts (v1.4.0)
├── puppetlabs-inifile (v6.1.1)
├── puppetlabs-powershell (v6.0.0)
├── puppetlabs-puppet_agent (v4.19.0)
├── puppetlabs-pwshlib (v1.1.1)
├── puppetlabs-reboot (v5.0.0)
├── puppetlabs-registry (v5.0.1)
├── puppetlabs-ruby_task_helper (v0.6.1)
└── puppetlabs-stdlib (v9.6.0)
/etc/puppetlabs/code/modules (no modules installed)
/opt/puppetlabs/puppet/modules (no modules installed)
`

Expected Behavior

Package installs.

Steps to Reproduce

Steps to reproduce the behavior:

Install the following modules:
mod 'puppetlabs/stdlib', '9.6.0' mod 'puppetlabs/concat', '9.0.2' mod 'puppetlabs-chocolatey', '8.0.0' mod 'puppetlabs-powershell', '6.0.0' mod 'puppetlabs-registry', '5.0.1' mod 'puppetlabs-ruby_task_helper', '0.6.1' mod 'puppetlabs-acl', '5.0.0' mod 'puppetlabs-reboot', '5.0.0' mod 'puppetlabs-puppet_agent', '4.19.0' mod 'puppetlabs-apt', '9.4.0' mod 'puppetlabs-facts', '1.4.0' mod 'puppetlabs-inifile', '6.1.1' mod 'puppetlabs-pwshlib', '1.1.1'

Add the following to site.pp:
`
include chocolatey
node default {

This is where you can declare classes for all nodes.

Example:

class { 'my_class': }

if $::kernel == 'windows' {
Package { provider => chocolatey, }
}
class {'chocolatey':
log_output => true,
}
package { 'etcher':
ensure => latest,
provider => 'chocolatey',
}
}
On the windows agent, run:puppet agent --test --trace --debug --verbose`

Environment

  • Version 8.0.0
  • Platform Ubuntu 22.04 master, Windows 11 23H2 agent

Additional Context

I'm very new to Puppet. I'ms sure I'm probably just missing something stupid.

Corrective changes for several packages during each run with `chocolatey` 2.0.0

Describe the Bug

Corrective changes for several packages during each run after updating to chocolatey version 2.0.0.

Expected Behavior

No corrective changes during each run after installing a package.

Steps to Reproduce

  1. Ensure a package resource in the catalog for a package with semantic versioning, e.g. putty or pdfxchangeditor.
  2. Run Puppet twice.

Environment

  • Version: Puppet 6
  • Platform: Windows 10 / 11

Additional Context

Example changes:

/Stage[main]/Profile::Chocolatey/Package[putty]/ensure | ensure changed '0.78.0' to '0.78' (corrective)
/Stage[main]/Profile::Pdfxchange/Package[pdfxchangeeditor]/ensure | ensure changed '9.5.368' to '9.5.368.0' (corrective)
/Stage[main]/Profile::Bginfo/Package[bginfo]/ensure | ensure changed '4.32.0' to '4.32' (corrective)

i.e. the changed treatment of versioning is not yet taken care of in this module.

see also #321

Upcoming major releases of Chocolatey products that may impact functionality on the module

I'm the Technical Engineering Manager at Chocolatey Software, Inc. and I wanted to make sure you are aware that there will be a new major release of Chocolatey products soon. As it is a major release, we are making changes that may have an impact on the Puppet module.

We have beta versions of Chocolatey CLI and Chocolatey GUI publicly available that you can test against.

The release notes for the various products are below (some may or may not be applicable to the module, but I wanted to list them all for completeness):

We have no fixed date for release as yet, but it is coming soon.

Apologies for the non-standard issue (I could not find any other way to contact the team). Please let me know if I can help in any way

Nightly acceptance tests are flakey for Windows 2016

Describe the Bug

Nightly acceptance flakey are failing for Windows 2016.

Ideally we should solve this issue before we cut a new release.

Expected Behavior

The tests should pass

Steps to Reproduce

Run the acceptance tests or take a look here

Environment

  • Version Puppet 6/7
  • Platform Windows 2016

Additional Context

N/A

Puppet always appends "ignore-package-exit-codes" to choco upgrade

Describe the Bug

I want to enable use of the package exit codes in my setup. I've enabled that feature using the "chocolateyfeature" resource (even though it is enabled by default), but every time puppet runs a choco upgrade command, "--ignore-package-exit-codes" and "--no-progress" are automatically appended to the command line.

Expected Behavior

I would like to be able to remove the --ignore-package-exit-codes argument that is automatically appended, or replace it with --use-package-exit-codes instead.

Steps to Reproduce

Do a simple chrome install and update:

package { 'googlechrome':
ensure => latest,
provider => 'chocolatey',
}

Environment

Chocolatey v1.4.0
Puppet version 7.24.0
puppetlabs-chocolatey module 7.0.1

Failing to uninstall/upgrade package by running a task

Describe the Bug

I'm trying to uninstall or upgrade the package by running a task provided by chocolatey module. This fails with the message:
Error: unknown keywords: _task, _installdir

Expected Behavior

I would expect to have a successful run of a task. E.g. if I'd like to uninstall a package and run chocolatey task with action=uninstall and package={package_name} this will uninstall a {package_name} from the target node.

Steps to Reproduce

Steps to reproduce the behavior:

  1. In Puppet Enterprise web console go to Tasks
  2. Click on 'Run a task' button
  3. Select a 'chocolatey' task
  4. For 'action' parameter select either 'uninstall' or 'upgrade'
  5. For 'package' parameter type a {package_name} that's already installed on the target node
  6. Select a target node
  7. Click on 'Run task' button

Environment

  • Puppet enterprise version 2019.8
  • Node puppetversion 6.21.1
  • chocolatey module verison 6.2.0
  • chocolatey version 0.11.3
  • Node Platform Windows 10 Pro
  • architecture x64
  • choco_install_path C:\ProgramData\chocolatey
  • choco_temp_dir C:\WINDOWS\system32\config\systemprofile\AppData\Local\Temp

Disabling a source results in an endless loop of 'corrective' changes

Describe the Bug

I am writing code to manage a licensed Chocolatey install for a customer that has their systems locked down and unable to access the general Internet. As a result, we want to disable the Chocolatey licensed source.

When I use the code:

chocolateysource {'chocolatey.licensed':
  ensure => disabled,
}

I get a constant stream of 'corrective' changes where Puppet tries to change the user for this source to the empty string, and its priority to 0 (originally 'customer' and 10, respectively). Obviously, these changes aren't persisting, so Puppet tries to do them every time, without success.

Adding the parameters:

  user     => 'customer',
  password => 'nopass',
  priority => 10,

within the chocolateysource code block results in the proper idempotent behaviour. (Which has then led to the security team questioning the plain text password in the code - though after I explained the reason, they were fine with it.)

Expected Behavior

Disabling a source should not result in a constant stream of corrective changes. (Note that I have not tried disabling any other source; the issue may be specific to the chocolatey.licensed source.)

Steps to Reproduce

See above.

Environment

  • Puppet Labs chocolatey provider 5.2.1 (the problematic code appears to still be present in 6.2.0)
  • PE version 2019.8.7
  • Windows Server 2019
  • Chocolatey version 1.1.0

Additional Context

Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.