Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-18.04', 'macos-10.15', 'windows-2016' ]
puppet_version: [ 5, 6, 7 ]
puppet_version: [ 6, 7 ]
include:
- puppet_version: 5
ruby: 2.4
- puppet_version: 6
ruby: 2.5
- puppet_version: 7
Expand Down Expand Up @@ -52,6 +50,7 @@ jobs:
run: |
git config --global core.longpaths true
bundle config set system 'true'
bundle config set --local without 'release'
${{ matrix.env_set_cmd }}PUPPET_GEM_VERSION=$(ruby -e 'puts /puppet\s+\((.+)\)/.match(`gem list -eld puppet`)[1]')
bundle update --jobs 4 --retry 3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Run checks

env:
ruby_version: 2.5
ruby_version: 2.6

runs-on: 'ubuntu-18.04'
steps:
Expand All @@ -29,6 +29,7 @@ jobs:
- name: Prepare testing environment with bundler
run: |
git config --global core.longpaths true
bundle config set --local without 'release'
bundle update --jobs 4 --retry 3
- name: Run commits check
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/unit_tests_with_nightly_puppet_gem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-18.04', 'macos-10.15', 'windows-2016' ]
puppet_version: [ 5, 6, 7 ]
puppet_version: [ 6, 7 ]
include:
- puppet_version: 5
ruby: 2.4
- puppet_version: 6
ruby: 2.5
- puppet_version: 7
Expand Down Expand Up @@ -54,6 +52,7 @@ jobs:
run: |
git config --global core.longpaths true
bundle config set system 'true'
bundle config set --local without 'release'
${{ matrix.env_set_cmd }}PUPPET_GEM_VERSION=$(ruby -e 'puts /puppet\s+\((.+)\)/.match(`gem list -eld puppet`)[1]')
bundle update --jobs 4 --retry 3
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/unit_tests_with_released_puppet_gem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-18.04', 'macos-10.15', 'windows-2016' ]
puppet_version: [ 5, 6 ]
puppet_version: [ 6, 7 ]
include:
- puppet_version: 5
ruby: 2.4
- puppet_version: 6
ruby: 2.5
- puppet_version: 7
ruby: 2.7

- os: 'ubuntu-18.04'
os_type: 'Linux'
Expand All @@ -42,6 +42,7 @@ jobs:
- name: Prepare testing environment with bundler
run: |
git config --global core.longpaths true
bundle config set --local without 'release'
bundle update --jobs 4 --retry 3
- name: Run unit tests
Expand Down
49 changes: 49 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/acceptance/
/coverage/
/bin/
/doc/
/docker/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/task_spec/
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
/.gitattributes
/.gitignore
/.github/
/.gitlab-ci.yml
/.pdkignore
/.puppet-lint.rc
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.rubocop_todo.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
/.sync.yml
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ AllCops:
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- files/*
inherit_from: .rubocop_todo.yml
Metrics/LineLength:
Description: People have wide screens, use them.
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.5.0] - 2021-03-23

### Summary
The module can now manage agent configuration. Various Windows fixes and additions, task updates.

### Features

- ([MODULES-10879](https://tickets.puppetlabs.com/browse/MODULES-10879)) Implement configuration management ([#525](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/525))
- ([MODULES-10909](https://tickets.puppetlabs.com/browse/MODULES-10909)) Retry task commands in case of network connectivity failures ([#536](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/536))
- ([MODULES-9798](https://tickets.puppetlabs.com/browse/MODULES-9798)) Add timeout parameter for current Puppet run ([#537](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/537))
- Ignore unneeded paths when packaging the module ([#540](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/540))
- ([MODULES-10925](https://tickets.puppetlabs.com/browse/MODULES-10925)) Add facts_diff task ([#542](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/542))

### Bug fixes

- Update puppet-20250406 GPG key ([#538](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/538))
- Fix upgrading Puppet on Windows ([#539](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/539))

### Acknowledgements

Thanks to [smortex](https://github.com/smortex) and [phil4business](https://github.com/phil4business) who have contributed to this release 🎉!

## [4.4.0] - 2021-01-20

### Summary
Expand Down
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant code of conduct

## Our pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language.
* Being respectful of differing viewpoints and experiences.
* Gracefully accepting constructive criticism.
* Focusing on what is best for the community.
* Showing empathy towards other community members.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances.
* Trolling, insulting/derogatory comments, and personal or political attacks.
* Public or private harassment.
* Publishing others' private information, such as a physical or electronic
address, without explicit permission.
* Other conduct which could reasonably be considered inappropriate in a
professional setting.

## Our responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this code of conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at conduct@puppet.com. The project team
will review and investigate all complaints, and will respond in a way that it
deems appropriate to the circumstances. The project team is obligated to
maintain confidentiality with regard to the reporter of an incident. Further
details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the code of conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This code of conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org [version]:
http://contributor-covenant.org/version/1/4/
65 changes: 34 additions & 31 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,38 @@ minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}"
#end

group :development do
gem "facterdb", '~> 1.4', :require => false
gem "mocha", '~> 1.1', :require => false
gem "parser", '~> 2.5', :require => false
gem "puppet-syntax", '~> 2.6', :require => false
gem "specinfra", '2.82.2', :require => false
gem "diff-lcs", '~> 1.3', :require => false
gem "faraday", '~> 0.17', :require => false
gem "pry-byebug", '~> 3.8', :require => false
gem "pry", '~> 0.10', :require => false
gem "method_source", '~> 0.8', :require => false
gem "rake", '~> 12', :require => false
gem "parallel_tests", '>= 2.14.1', '< 2.14.3', :require => false
gem "metadata-json-lint", '>= 2.0.2', '< 3.0.0', :require => false
gem "rspec-puppet-facts", '~> 1.10.0', :require => false
gem "rspec_junit_formatter", '~> 0.2', :require => false
gem "rubocop", '~> 0.49.0', :require => false
gem "rubocop-rspec", '~> 1.16.0', :require => false
gem "rubocop-i18n", '~> 1.2.0', :require => false
gem "puppetlabs_spec_helper", '>= 2.9.0', '< 3.0.0', :require => false
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "rspec-puppet", :require => true, git: "https://github.com/rodjek/rspec-puppet", tag: "v2.7.9"
gem 'rspec-expectations', '~> 3.9.0', :require => false
gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "facterdb", '~> 1.4', require: false
gem "mocha", '~> 1.1', require: false
gem "parser", '~> 2.5', require: false
gem "puppet-syntax", '~> 2.6', require: false
gem "specinfra", '2.82.2', require: false
gem "diff-lcs", '~> 1.3', require: false
gem "faraday", '~> 0.17', require: false
gem "pry-byebug", '~> 3.8', require: false
gem "pry", '~> 0.10', require: false
gem "method_source", '~> 0.8', require: false
gem "rake", '~> 12', require: false
gem "parallel_tests", '>= 2.14.1', '< 2.14.3', require: false
gem "metadata-json-lint", '>= 2.0.2', '< 3.0.0', require: false
gem "rspec-puppet-facts", '~> 1.10.0', require: false
gem "rspec_junit_formatter", '~> 0.2', require: false
gem "rubocop", '~> 0.49.0', require: false
gem "rubocop-rspec", '~> 1.16.0', require: false
gem "rubocop-i18n", '~> 1.2.0', require: false
gem "puppetlabs_spec_helper", '>= 2.9.0', '< 3.0.0', require: false
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: "ruby"
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: ["mswin", "mingw", "x64_mingw"]
gem "rspec-puppet", require: true, git: "https://github.com/rodjek/rspec-puppet", tag: "v2.7.9"
gem 'rspec-expectations', '~> 3.9.0', require: false
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "puppet-lint", '2.3.6'
end

group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-system-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby]
gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4')
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || ["~> 1.0", ">= 1.0.1"])
gem "beaker-docker", '~> 0.3'
Expand All @@ -69,16 +69,19 @@ group :system_tests do
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem 'pdk', *location_for(ENV['PDK_GEM_VERSION'])
gem "puppet-blacksmith", '~> 3.4', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.7.0')
gem "puppet-blacksmith", '~> 6', :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.7.0')
# Bundler fails on 2.1.9 even though this group is excluded
if ENV['GEM_BOLT']
gem 'bolt', '~> 1.15', require: false
gem 'beaker-task_helper', '~> 1.5.2', require: false
end
end

group :release do
gem 'pdk', *location_for(ENV['PDK_GEM_VERSION'] || '~> 2')
gem "puppet-blacksmith", '~> 3.4', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.7.0')
gem "puppet-blacksmith", '~> 6', require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.7.0')
end

gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])

# Only explicitly specify Facter/Hiera if a version has been specified.
Expand Down
24 changes: 23 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- [`install_options`](#install_options)
- [`msi_move_locked_files`](#msi_move_locked_files)
- [`wait_for_pxp_agent_exit`](#wait_for_pxp_agent_exit)
- [`wait_for_puppet_run`](#wait_for_puppet_run)
- [Plans](#plans)
- [`puppet_agent::run`](#puppet_agentrun)
- [Tasks](#tasks)
Expand All @@ -58,7 +59,7 @@

## Overview

A module for upgrading Puppet agents. Supports upgrading from Puppet 4 puppet-agent packages to later versions including Puppet 4, Puppet 5, and Puppet 6.
A module for installing, running, upgrading, and managing the configuration of Puppet agents. Supports upgrading from Puppet 4 puppet-agent packages to later versions including Puppet 4, Puppet 5, and Puppet 6.

Previous releases of this module, now unsupported, upgraded agents from later versions of Puppet 3 to Puppet 4.

Expand All @@ -68,6 +69,8 @@ The puppet_agent module installs the appropriate official Puppet package reposit

If a package_version parameter is provided, it will ensure that puppet-agent version is installed. The package_version parameter is required to perform upgrades starting from a puppet-agent package, also this parameter can be set to "auto", ensuring that agent version matches the version on the master without having to manually update package_version after upgrading the master(s).

If a config parameter is provided, it will manage the defined agent configuration settings.

## Setup

### What puppet_agent affects
Expand Down Expand Up @@ -311,6 +314,25 @@ This is only applicable for Windows operating systems and pertains to /files/ins
wait_for_pxp_agent_exit => 480000
```

#### `wait_for_puppet_run`

This is only applicable for Windows operating systems and pertains to /files/install_puppet.ps1 script. This parameterizes the module to define the wait time for the current puppet agent run to end successfully. The default value is 2 minutes and the timeout value must be defined in milliseconds. Example below, 8 minutes is equal to 480000.

``` puppet
wait_for_puppet_run => 480000
```

#### `config`

An array of configuration data to enforce. Each configuration data item must be a Puppet\_agent::Config hash, which has keys for puppet.conf section, setting, and value. This parameter is constrained to managing only a predetermined set of configuration settings. E.g. runinterval. The optional "ensure" key in a Puppet\_agent::Config hash can be used to ensure a setting is absent. In the example below, the runinterval setting in the main section is set to 1 hour, and a local environment setting is ensured absent.

``` puppet
config => [{section => main, setting => runinterval, value => '1h'},
{section => main, setting => environment, ensure => absent}]
```

Valid agent settings are defined by the [`Puppet_agent::Config_setting`](types/config_setting.pp) type alias.

### Plans

#### `puppet_agent::run`
Expand Down
2 changes: 1 addition & 1 deletion acceptance/tests/test_upgrade_puppet5_to_puppet6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
test_name 'puppet_agent class: Upgrade agents from puppet5 to puppet6' do
require_master_collection 'puppet6-nightly'
exclude_pe_upgrade_platforms
latest_version = `curl http://builds.delivery.puppetlabs.net/passing-agent-SHAs/puppet-agent-master-version`
latest_version = `curl http://builds.delivery.puppetlabs.net/passing-agent-SHAs/puppet-agent-6.x-version`

puppet_testing_environment = new_puppet_testing_environment

Expand Down
Loading