Showing with 37 additions and 5 deletions.
  1. +17 −0 CHANGELOG.md
  2. +1 −0 README.md
  3. +1 −0 manifests/init.pp
  4. +1 −1 manifests/params.pp
  5. +2 −2 metadata.json
  6. +6 −0 spec/classes/unattended_upgrades_spec.rb
  7. +7 −1 templates/unattended-upgrades.erb
  8. +1 −0 types/auto.pp
  9. +1 −1 types/origin.pp
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ 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.1.0](https://github.com/voxpupuli/puppet-unattended_upgrades/tree/v7.1.0) (2022-08-28)

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

**Implemented enhancements:**

- Add reboot\_withusers option to unattended-upgrades.erb [\#214](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/214) ([jps-help](https://github.com/jps-help))
- Support the option Unattended-Upgrade::Package-Whitelist-Strict [\#213](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/213) ([makmarius](https://github.com/makmarius))

**Fixed bugs:**

- types/origin: fix typo in comment [\#212](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/212) ([kenyon](https://github.com/kenyon))

**Merged pull requests:**

- puppetlabs/apt: Allow 9.x [\#215](https://github.com/voxpupuli/puppet-unattended_upgrades/pull/215) ([bastelfreak](https://github.com/bastelfreak))

## [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)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ altering some of the default settings.
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_withusers`(`true`): If automatic reboot is enabled and needed, reboot even if there are users currently logged in.
* `reboot_time`(`now`): If automatic reboot is enabled and needed, reboot at the
specific time (instead of immediately). Expects a string in the format "HH:MM", using the 24 hour clock with leading zeros. Examples: "16:37" for 37 minutes past 4PM, or "02:03" for 3 minutes past 2AM.
* `remove`(`true`): Remove unneeded dependencies after update installation.
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
Optional[Boolean] $syslog_enable = undef,
Optional[String] $syslog_facility = undef,
Optional[Boolean] $only_on_ac_power = undef,
Optional[Boolean] $whitelist_strict = undef,
) inherits unattended_upgrades::params {
# apt::conf settings require the apt class to work
include apt
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fail('This module only works on Debian or derivatives like Ubuntu')
}

$default_auto = { 'fix_interrupted_dpkg' => true, 'remove' => true, 'reboot' => false, 'clean' => 0, 'reboot_time' => 'now', }
$default_auto = { 'fix_interrupted_dpkg' => true, 'remove' => true, 'reboot' => false, 'reboot_withusers' => true, 'clean' => 0, 'reboot_time' => 'now', }
$default_mail = { 'only_on_error' => true, }
$default_backup = { 'archive_interval' => 0, 'level' => 3, }
$default_age = { 'min' => 2, 'max' => 0, }
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-unattended_upgrades",
"version": "7.0.0",
"version": "7.1.0",
"author": "Vox Pupuli",
"summary": "Provides an interface for managing Apt unattended_upgrades with Puppet",
"license": "Apache-2.0",
Expand Down Expand Up @@ -44,7 +44,7 @@
},
{
"name": "puppetlabs/apt",
"version_requirement": ">= 2.2.0 < 9.0.0"
"version_requirement": ">= 2.2.0 < 10.0.0"
}
]
}
6 changes: 6 additions & 0 deletions spec/classes/unattended_upgrades_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
'fix_interrupted_dpkg' => false,
'remove' => false,
'reboot' => true,
'reboot_withusers' => false,
'reboot_time' => '03:00'
},
verbose: 1,
Expand All @@ -75,6 +76,7 @@
syslog_enable: true,
syslog_facility: 'daemon',
only_on_ac_power: false,
whitelist_strict: true,
}
end

Expand Down Expand Up @@ -104,6 +106,8 @@
%r{Unattended-Upgrade::Package-Blacklist {\n\t"foo";\n\t"bar";\n};}
).with_content(
%r{Unattended-Upgrade::Package-Whitelist {\n\t"foo";\n\t"bar";\n};\n}
).with_content(
%r{Unattended-Upgrade::Package-Whitelist-Strict "true";}
).with_content(
%r{Unattended-Upgrade::Update-Days {\n\t"Tuesday";\n\t"Thursday";\n\t"5";\n};}
).with_content(
Expand All @@ -116,6 +120,8 @@
%r{Unattended-Upgrade::Remove-Unused-Dependencies "false";}
).with_content(
%r{Unattended-Upgrade::Automatic-Reboot "true";}
).with_content(
%r{Unattended-Upgrade::Automatic-Reboot-WithUsers "false";}
).with_content(
%r{Unattended-Upgrade::Automatic-Reboot-Time "03:00";}
).with_content(
Expand Down
8 changes: 7 additions & 1 deletion templates/unattended-upgrades.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ Unattended-Upgrade::Package-Whitelist {
"<%= package %>";
<% end -%>
};

<% unless @whitelist_strict.nil? -%>
Unattended-Upgrade::Package-Whitelist-Strict "<%= @whitelist_strict %>";
<% end -%>
<% end -%>
// List of days in the week that updates should be applied.
// The days can be specified as localized abbreviated or full names.
Expand Down Expand Up @@ -102,6 +104,10 @@ Unattended-Upgrade::Remove-Unused-Dependencies "<%= @_auto['remove'].to_s %>";
// if the file /var/run/reboot-required is found after the upgrade
Unattended-Upgrade::Automatic-Reboot "<%= @_auto['reboot'].to_s %>";

// Automatically reboot even if there are users currently logged in
// when Unattended-Upgrade::Automatic-Reboot is set to true
Unattended-Upgrade::Automatic-Reboot-WithUsers "<%= @_auto['reboot_withusers'].to_s %>";

// If automatic reboot is enabled and needed, reboot at the specific
// time instead of immediately
// Default: "now"
Expand Down
1 change: 1 addition & 0 deletions types/auto.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Optional['clean'] => Variant[Integer[0], Enum['always']],
Optional['fix_interrupted_dpkg'] => Boolean,
Optional['reboot'] => Boolean,
Optional['reboot_withusers'] => Boolean,
Optional['reboot_time'] => String,
Optional['remove'] => Boolean,
}
Expand Down
2 changes: 1 addition & 1 deletion types/origin.pp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# @summary Validate that the given input is accepted as an `Unattended-Upgrade::Origin-Pattern`.
# @summary Validate that the given input is accepted as an `Unattended-Upgrade::Origins-Pattern`.
type Unattended_upgrades::Origin = Pattern[/^(origin|codename|label|site|suite|component|archive|[oalcn])=[^,]+(,(origin|codename|label|site|suite|component|archive|[oalcn])=[^,]+)*/]