Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_updates_on_metered_connection option #255

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ altering some of the default settings.
* `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`.
* `skip_updates_on_metered_connection` (`undef`): Download and install upgrades only on non-metered connection. Default is `true`.
* `allow_downgrade` (`undef`): Allow package downgrade if Pin-Priority exceeds 1000. Default is `false`.
* `dpkg_options` (`[]`): Pass options to `dpkg`

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] $skip_updates_on_metered_connection = undef,
Optional[Boolean] $whitelist_strict = undef,
Optional[Boolean] $allow_downgrade = undef,
Array[String[1]] $dpkg_options = [],
Expand Down
3 changes: 3 additions & 0 deletions spec/classes/unattended_upgrades_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
syslog_enable: true,
syslog_facility: 'daemon',
only_on_ac_power: false,
skip_updates_on_metered_connection: false,
whitelist_strict: true,
allow_downgrade: false,
dpkg_options: ['--force-confold', '--force-confdef'],
Expand Down Expand Up @@ -146,6 +147,8 @@
%r{Unattended-Upgrade::SyslogFacility "daemon";}
).with_content(
%r{Unattended-Upgrade::OnlyOnACPower "false";}
).with_content(
%r{Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";}
).with_content(
%r{Unattended-Upgrade::Allow-downgrade "false";}
).with_content(
Expand Down
6 changes: 6 additions & 0 deletions templates/unattended-upgrades.erb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ Unattended-Upgrade::SyslogFacility "<%= @syslog_facility %>";
Unattended-Upgrade::OnlyOnACPower "<%= @only_on_ac_power %>";
<%- end -%>

<%- unless @skip_updates_on_metered_connection.nil? -%>
// Download and install upgrades only on non-metered connection
// (i.e. skip or gracefully stop updates on a metered connection)
Unattended-Upgrade::Skip-Updates-On-Metered-Connections "<%= @skip_updates_on_metered_connection %>";
<%- end -%>

<%- unless @allow_downgrade.nil? -%>
// Allow package downgrade if Pin-Priority exceeds 1000
Unattended-Upgrade::Allow-downgrade "<%= @allow_downgrade %>";
Expand Down
Loading