File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616# An array of additional packages that need to be installed to support
1717# docker. Defaults change depending on the operating system.
1818#
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+ #
1924# [*tcp_bind*]
2025# The tcp socket to bind to in the format
2126# tcp://127.0.0.1:4243
386391 Optional[String] $version = $docker::params::version,
387392 String $ensure = $docker::params::ensure,
388393 Variant[Array[String], Hash] $prerequired_packages = $docker::params::prerequired_packages,
394+ Array $dependent_packages = $docker::params::dependent_packages,
389395 String $docker_ce_start_command = $docker::params::docker_ce_start_command,
390396 Optional[String] $docker_ce_package_name = $docker::params::docker_ce_package_name,
391397 Optional[String] $docker_ce_source_location = $docker::params::package_ce_source_location,
Original file line number Diff line number Diff line change 2525 $nuget_package_provider_version = $docker::nuget_package_provider_version,
2626 $docker_msft_provider_version = $docker::docker_msft_provider_version,
2727 $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+
2931) {
3032 $docker_start_command = $docker::docker_start_command
3133 if $::osfamily {
8890 ensure => $ensure ,
8991 name => $docker::docker_package_name ,
9092 }))
93+ if $ensure == ' absent' {
94+ ensure_resource(' package' , $dependent_packages , {
95+ ensure => $ensure ,
96+ })
97+ }
9198 } else {
9299 if $ensure == ' absent' {
93100 exec { 'remove-docker-package' :
Original file line number Diff line number Diff line change 305305 ' RedHat' => [' device-mapper' ],
306306 default => [],
307307 }
308+ $dependent_packages = [' docker-ce-cli' ,' containerd.io' ]
309+
308310}
Original file line number Diff line number Diff line change 706706 } }
707707 it { should contain_file ( service_config_file ) . with_content ( /-g \/ mnt\/ docker/ ) }
708708 end
709-
709+
710710 context 'with custom root dir && Docker version > 17.05' do
711711 let ( :params ) { {
712712 'root_dir' => '/mnt/docker' ,
713713 'version' => '18.03' ,
714714 } }
715715 it { should contain_file ( service_config_file ) . with_content ( /--data-root \/ mnt\/ docker/ ) }
716716 end
717-
717+
718718
719719 context 'with ensure absent' do
720720 let ( :params ) { { 'ensure' => 'absent' } }
721721 it { should contain_package ( 'docker' ) . with_ensure ( 'absent' ) }
722722 end
723723
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+
724731 context 'with an invalid combination of devicemapper options' do
725732 let ( :params ) {
726733 { 'dm_datadev' => '/dev/mapper/vg_test-docker--pool_tdata' ,
You can’t perform that action at this time.
0 commit comments