From de4ce5d0a868b49266deab341cd5bb688cd0912f Mon Sep 17 00:00:00 2001 From: Anders Larsson Date: Tue, 17 Oct 2023 07:52:20 +0200 Subject: [PATCH] Remove docker_version fact and version check Fact $docker_version clashes with $docker_version provided by puppetlabs-docker. --- lib/facter/docker_version.rb | 16 ---------------- manifests/init.pp | 6 ------ spec/classes/init_spec.rb | 14 -------------- spec/default_module_facts.yml | 3 +-- 4 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 lib/facter/docker_version.rb diff --git a/lib/facter/docker_version.rb b/lib/facter/docker_version.rb deleted file mode 100644 index 51b2b0d..0000000 --- a/lib/facter/docker_version.rb +++ /dev/null @@ -1,16 +0,0 @@ -# docker_version.rb - -Facter.add('docker_version') do - confine kernel: 'Linux' - - setcode do - docker_bin = '/usr/bin/docker' - version = 'none' - - if File.file?(docker_bin) - version = `#{docker_bin} version -f '{{.Client.Version}}' 2> /dev/null`.strip - end - - version - end -end diff --git a/manifests/init.pp b/manifests/init.pp index a9fc855..54f2a29 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,12 +44,6 @@ Optional[Hash] $resources = undef, Optional[Hash] $users = undef, ) { - $dockerversion = '1.12.0' - - if versioncmp($facts['docker_version'], $dockerversion) < 0 { - fail("HBM requires Docker Engine version >=${dockerversion}. Your version is ${facts['docker_version']}.") - } - if $manage_package { package { 'package_hbm': ensure => installed, diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index b6dc29a..421f5af 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -150,19 +150,5 @@ ) end end - - context "on #{os} with unsupported version of docker" do - let(:facts) do - os_facts.merge( - { - docker_version: '1.11.0', - }, - ) - end - - it 'fail' do - expect { is_expected.to contain_class(:subject) }.to raise_error(Puppet::Error, %r{HBM requires Docker Engine version >=1.12.0. Your version is 1.11.0.}) - end - end end end diff --git a/spec/default_module_facts.yml b/spec/default_module_facts.yml index 684a892..9d87409 100644 --- a/spec/default_module_facts.yml +++ b/spec/default_module_facts.yml @@ -1,5 +1,4 @@ # Use default_module_facts.yml for module specific facts. # # Facts specified here will override the values provided by rspec-puppet-facts. ---- -docker_version: '1.12.0' +--- {}