7 changes: 3 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:

```sh
export PUPPET_VERSION="~> 5.5.6"
export PUPPET_GEM_VERSION="~> 6.1.0"
```

You can install all needed gems for spec tests into the modules directory by
Expand Down Expand Up @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this
with:

```sh
BEAKER_setfile=debian10-x64 bundle exec rake beaker
BEAKER_setfile=debian11-64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* ubuntu2004
* debian9
* debian10
* debian11
* centos7
* centos8

Expand Down
84 changes: 6 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,12 @@ name: CI
on: pull_request

concurrency:
group: ${{ github.head_ref }}
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
env:
BUNDLE_WITHOUT: development:system_tests:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false

unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake parallel_spec

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
with:
pidfile_workaround: 'false'
32 changes: 10 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,14 @@ on:
tags:
- '*'

env:
BUNDLE_WITHOUT: development:test:system_tests

jobs:
deploy:
name: 'deploy to forge'
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Build and Deploy
env:
# Configure secrets here:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}'
run: bundle exec rake module:push
release:
name: Release
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
with:
allowed_owner: 'voxpupuli'
secrets:
# Configure secrets here:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '4.2.0'
modulesync_config_version: '5.3.0'
2 changes: 2 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--fail-on-warnings
--no-parameter_documentation-check
3 changes: 3 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
spec/spec_helper_acceptance.rb:
unmanaged: false
.puppet-lint.rc:
enabled_lint_checks:
- parameter_types
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v7.0.0](https://github.com/voxpupuli/puppet-unattended_upgrades/tree/v7.0.0) (2022-06-16)

[Full Changelog](https://github.com/voxpupuli/puppet-unattended_upgrades/compare/v6.0.0...v7.0.0)

**Breaking changes:**

- Replace legacy Allowed-Origins with Origins-Pattern on all distros [\#204](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/204) ([towo](https://github.com/towo))
- retire options support [\#190](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/190) ([anarcat](https://github.com/anarcat))

**Implemented enhancements:**

- Cleanup legacy fact usage [\#210](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/210) ([bastelfreak](https://github.com/bastelfreak))
- Add only\_on\_ac\_power option to unattended-upgrades.erb [\#208](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/208) ([jps-help](https://github.com/jps-help))

**Fixed bugs:**

- Add missing 'always' value support to periodic parameters \(every n-days\) [\#206](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/206) ([Hufschmidt](https://github.com/Hufschmidt))
- params: debian default: re-add main origin [\#201](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/201) ([kenyon](https://github.com/kenyon))

**Closed issues:**

- \[Ubuntu 20.04.3\] Traceback when running unattended-upgrades --debug --dry-run [\#202](https://github.com/voxpupuli/puppet-unattended_upgrades/issues/202)

**Merged pull requests:**

- README: remove legacy\_origin [\#205](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/205) ([kenyon](https://github.com/kenyon))

## [v6.0.0](https://github.com/voxpupuli/puppet-unattended_upgrades/tree/v6.0.0) (2021-09-29)

[Full Changelog](https://github.com/voxpupuli/puppet-unattended_upgrades/compare/v5.1.0...v6.0.0)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /opt/puppet
# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39
RUN mkdir -p /etc/sv

ARG PUPPET_VERSION="~> 6.0"
ARG PUPPET_GEM_VERSION="~> 6.0"
ARG PARALLEL_TEST_PROCESSORS=4

# Cache gems
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

source ENV['GEM_SOURCE'] || "https://rubygems.org"
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 2.5', :require => false
gem 'voxpupuli-test', '~> 5.4', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 1.0', :require => false
Expand All @@ -21,14 +21,14 @@ end

group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
gem 'voxpupuli-release', '>= 1.0.2', :require => false
gem 'voxpupuli-release', '>= 1.2.0', :require => false
gem 'puppet-strings', '>= 2.2', :require => false
end

gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]

puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0'
puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0'
gem 'puppet', puppetversion, :require => false, :groups => [:test]

# vim: syntax=ruby
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Unattended Upgrades module for Puppet

[![Build Status](https://travis-ci.org/voxpupuli/puppet-unattended_upgrades.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-unattended_upgrades)
[![Build Status](https://github.com/voxpupuli/puppet-unattended_upgrades/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-unattended_upgrades/actions?query=workflow%3ACI)
[![Release](https://github.com/voxpupuli/puppet-unattended_upgrades/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-unattended_upgrades/actions/workflows/release.yml)
[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/unattended_upgrades.svg)](https://forge.puppetlabs.com/puppet/unattended_upgrades)
[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/unattended_upgrades.svg)](https://forge.puppetlabs.com/puppet/unattended_upgrades)
[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/unattended_upgrades.svg)](https://forge.puppetlabs.com/puppet/unattended_upgrades)
[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/unattended_upgrades.svg)](https://forge.puppetlabs.com/puppet/unattended_upgrades)
[![puppetmodule.info docs](http://www.puppetmodule.info/images/badge.png)](http://www.puppetmodule.info/m/puppet-unattended_upgrades)
[![AGPL v3 License](https://img.shields.io/github/license/voxpupuli/puppet-unattended_upgrades.svg)](LICENSE)

#### Table of Contents

Expand Down Expand Up @@ -75,8 +78,8 @@ altering some of the default settings.
```

* `auto` (`{}`): A hash of settings with these possible keys:
* `clean`(`0`): Remove packages that can no longer be downloaded from cache every
X days (`0` = disabled).
* `clean`(`0`): Remove packages that can no longer be downloaded from cache every X days (`0` = disabled).
Also supports 'always' as value to execute this operation every time the script is executed.
* `fix_interrupted_dpkg`(`true`): Try to fix package installation state.
* `reboot`(`false`): Reboot system after package update installation.
* `reboot_time`(`now`): If automatic reboot is enabled and needed, reboot at the
Expand Down Expand Up @@ -108,9 +111,6 @@ altering some of the default settings.
* `enable` (`1`): Enable the automatic installation of updates.
* `install_on_shutdown` (`false`): Install updates on shutdown instead of in the
background.
* `legacy_origin` (`true` for Debian (squeeze), Ubuntu (precise, trusty,
xenial, bionic and default), `false` for Debian (wheezy and default)):
Use the legacy `Unattended-Upgrade::Allowed-Origins` setting or the modern `Unattended-Upgrade::Origins-Pattern`.
* `mail`: A hash to configure email behaviour with the following possible keys:
* `report` (`undef`): Possible values are "always", "only-on-error" or "on-change". Defaults to "on-change". Note that "never" is achieved by not setting any `to` address.
* `only_on_error` (`true`): Only send mail when something went wrong. Deprecated in unattended-upgrades 1.13 and newer in favor of `report`.
Expand Down Expand Up @@ -141,10 +141,13 @@ altering some of the default settings.
cron job applies, which is 1800 seconds.
* `size` (`0`): Maximum size of the cache in MB.
* `update` (`1`): Do "apt-get update" automatically every n-days.
Also supports 'always' as value to execute this operation every time the script is executed.
* `upgrade` (`1`): Run the "unattended-upgrade" security upgrade script every n-days.
Also supports 'always' as value to execute this operation every time the script is executed.
* `days` (`[]`): Set the days of the week that updates should be applied. The days can be specified as localized abbreviated or full names. Or as integers where "0" is Sunday, "1" is Monday etc.
* `upgradeable_packages` (`{}`): A hash with two possible keys:
* `download_only` (`0`): Do "apt-get upgrade --download-only" every n-days.
Also supports 'always' as value to execute this operation every time the script is executed.
* `debdelta` (`1`): Use debdelta-upgrade to download updates if available.

Any of these keys can be specified and will be merged into the defaults:
Expand All @@ -156,17 +159,11 @@ altering some of the default settings.
```

* `verbose` (`0`): Send report mail to root.
* `options` (`{}`): A hash of settings with these possible keys:
* `force_confdef` (`true`) : Use the default option for new config files if one
is available, don't prompt. If no default can be found, you will be prompted
unless one of the confold or confnew options is also given
* `force_confold` (`true`): Always use the old config files, don't prompt
* `force_confnew` (`false`): Always use the new config files, don't prompt
* `force_confmiss` (`false`): Always install missing config files
* `remove_new_unused_deps` (`undef`): Automatic removal of newly unused dependencies after the upgrade.
* `remove_unused_kernel` (`undef`): Remove unused automatically installed kernel-related packages.
* `syslog_enable` (`undef`): Enable logging to syslog. Default is False.
* `syslog_facility` (`undef`): Specify syslog facility. Default is `daemon`.
* `only_on_ac_power` (`undef`): Download and install upgrades only on AC power. Default is `true`.

## Limitations

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper),
# otherwise attempt to load it directly.
begin
require 'voxpupuli/test/rake'
Expand Down
21 changes: 4 additions & 17 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
Optional[Integer[0]] $dl_limit = undef,
Integer[0, 1] $enable = 1,
Boolean $install_on_shutdown = false,
Boolean $legacy_origin = $unattended_upgrades::params::legacy_origin,
Unattended_upgrades::Mail $mail = {},
Boolean $minimal_steps = true,
Array[String[1]] $origins = $unattended_upgrades::params::origins,
Array[Unattended_upgrades::Origin] $origins = $unattended_upgrades::params::origins,
String[1] $package_ensure = installed,
Array[String[1]] $extra_origins = [],
Optional[Integer[0]] $random_sleep = undef,
Optional[String] $sender = undef,
Integer[0] $size = 0,
Integer[0] $update = 1,
Integer[0] $upgrade = 1,
Variant[Integer[0], Enum['always']] $update = 1,
Variant[Integer[0], Enum['always']] $upgrade = 1,
Unattended_upgrades::Upgradeable_packages $upgradeable_packages = {},
Integer[0] $verbose = 0,
Boolean $notify_update = false,
Unattended_upgrades::Options $options = {},
Array[String[1]] $days = [],
Optional[Boolean] $remove_unused_kernel = undef,
Optional[Boolean] $remove_new_unused_deps = undef,
Optional[Boolean] $syslog_enable = undef,
Optional[String] $syslog_facility = undef,
Optional[Boolean] $only_on_ac_power = undef,
) inherits unattended_upgrades::params {
# apt::conf settings require the apt class to work
include apt
Expand All @@ -46,12 +45,6 @@
$_upgradeable_packages = merge($unattended_upgrades::default_upgradeable_packages, $upgradeable_packages)
assert_type(Unattended_upgrades::Upgradeable_packages, $_upgradeable_packages)

if $options != {} {
warning('passing "options" is deprecated, use apt::conf directly instead')
}
$_options = merge($unattended_upgrades::default_options, $options)
assert_type(Unattended_upgrades::Options, $_options)

package { 'unattended-upgrades':
ensure => $package_ensure,
}
Expand All @@ -76,10 +69,4 @@
require => Package['unattended-upgrades'],
notify_update => $notify_update,
}
apt::conf { 'options':
priority => 10,
content => template("${module_name}/options.erb"),
require => Package['unattended-upgrades'],
notify_update => $notify_update,
}
}
Loading