File tree 4 files changed +25
-3
lines changed
4 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 16
16
# An array of additional packages that need to be installed to support
17
17
# docker. Defaults change depending on the operating system.
18
18
#
19
+ # [*dependent_packages*]
20
+ # An array of packages installed by the docker-ce package v 18.09 and later.
21
+ # Used when uninstalling to ensure containers cannot be run on the system.
22
+ # Defaults change depending on the operating system.
23
+ #
19
24
# [*tcp_bind*]
20
25
# The tcp socket to bind to in the format
21
26
# tcp://127.0.0.1:4243
386
391
Optional[String] $version = $docker::params::version,
387
392
String $ensure = $docker::params::ensure,
388
393
Variant[Array[String], Hash] $prerequired_packages = $docker::params::prerequired_packages,
394
+ Array $dependent_packages = $docker::params::dependent_packages,
389
395
String $docker_ce_start_command = $docker::params::docker_ce_start_command,
390
396
Optional[String] $docker_ce_package_name = $docker::params::docker_ce_package_name,
391
397
Optional[String] $docker_ce_source_location = $docker::params::package_ce_source_location,
Original file line number Diff line number Diff line change 25
25
$nuget_package_provider_version = $docker::nuget_package_provider_version,
26
26
$docker_msft_provider_version = $docker::docker_msft_provider_version,
27
27
$docker_ee_package_name = $docker::docker_ee_package_name,
28
- $docker_download_url = $docker::package_location
28
+ $docker_download_url = $docker::package_location,
29
+ $dependent_packages = $docker::dependent_packages,
30
+
29
31
) {
30
32
$docker_start_command = $docker::docker_start_command
31
33
if $::osfamily {
88
90
ensure => $ensure ,
89
91
name => $docker::docker_package_name ,
90
92
}))
93
+ if $ensure == ' absent' {
94
+ ensure_resource(' package' , $dependent_packages , {
95
+ ensure => $ensure ,
96
+ })
97
+ }
91
98
} else {
92
99
if $ensure == ' absent' {
93
100
exec { 'remove-docker-package' :
Original file line number Diff line number Diff line change 305
305
' RedHat' => [' device-mapper' ],
306
306
default => [],
307
307
}
308
+ $dependent_packages = [' docker-ce-cli' ,' containerd.io' ]
309
+
308
310
}
Original file line number Diff line number Diff line change 706
706
} }
707
707
it { should contain_file ( service_config_file ) . with_content ( /-g \/ mnt\/ docker/ ) }
708
708
end
709
-
709
+
710
710
context 'with custom root dir && Docker version > 17.05' do
711
711
let ( :params ) { {
712
712
'root_dir' => '/mnt/docker' ,
713
713
'version' => '18.03' ,
714
714
} }
715
715
it { should contain_file ( service_config_file ) . with_content ( /--data-root \/ mnt\/ docker/ ) }
716
716
end
717
-
717
+
718
718
719
719
context 'with ensure absent' do
720
720
let ( :params ) { { 'ensure' => 'absent' } }
721
721
it { should contain_package ( 'docker' ) . with_ensure ( 'absent' ) }
722
722
end
723
723
724
+ context 'with ensure absent and ' do
725
+ let ( :params ) { { 'ensure' => 'absent' } }
726
+ it { should contain_package ( 'docker' ) . with_ensure ( 'absent' ) }
727
+ it { should contain_package ( 'docker-ce-cli' ) . with_ensure ( 'absent' ) }
728
+ it { should contain_package ( 'containerd.io' ) . with_ensure ( 'absent' ) }
729
+ end
730
+
724
731
context 'with an invalid combination of devicemapper options' do
725
732
let ( :params ) {
726
733
{ 'dm_datadev' => '/dev/mapper/vg_test-docker--pool_tdata' ,
You can’t perform that action at this time.
0 commit comments