Skip to content

Commit d36c84d

Browse files
committed
adding documentation and tests for setting dpkg options unattended upgrades
Signed-off-by: Ben Abrams <me@benabrams.it>
1 parent 4f236fd commit d36c84d

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ For example, to prevent caching and directly connect to the repository at `downl
8383
"cacher_server": {
8484
"cache_bypass": {
8585
"download.oracle.com": "http",
86-
"nginx.org": "https"
86+
"nginx.org": "https"
8787
}
8888
}
8989
}
@@ -137,6 +137,7 @@ To pull just security updates, set `origins_patterns` to something like `["origi
137137
- `['apt']['unattended_upgrades']['random_sleep']` - Wait a random number of seconds up to this value before running daily periodic apt actions. System default is 1800 seconds (30 minutes).
138138
- `['apt']['unattended_upgrades']['syslog_enable']` - Enable logging to syslog. Defaults to false.
139139
- `['apt']['unattended_upgrades']['syslog_facility']` - Specify syslog facility. Defaults to 'daemon'.
140+
- `['apt']['unattended_upgrades']['dpkg_options']` An array of dpkg options to be used specifically only for unattended upgrades. Defaults to `[]` which will prevent it from being rendered from the template in the resulting file.
140141

141142
### Configuration for APT
142143

kitchen.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ suites:
4141
- name: resources
4242
run_list:
4343
- recipe[test::resources]
44+
# test that you can specifically modify some unattended upgrades options but leave the majority in place
45+
- recipe[test::unattended-upgrades]
4446
excludes: centos-7
47+
attributes:
48+
apt:
49+
unattended_upgrades:
50+
dpkg_options:
51+
- --force-confdef
52+
- --force-confold
4553

4654
- name: unattended-upgrades
4755
run_list:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if os.name == 'debian' || os.name == 'ubuntu'
2+
3+
describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
4+
it { should be_file }
5+
it { should be_owned_by 'root' }
6+
it { should be_grouped_into 'root' }
7+
it { should be_mode 0644 }
8+
its(:content) { should match(/"--force-confold";/) }
9+
end
10+
end

0 commit comments

Comments
 (0)