From c7a312531890834b5700c677a64618e61cbc51b5 Mon Sep 17 00:00:00 2001 From: mihaibuzgau Date: Wed, 25 Jul 2018 17:17:55 +0300 Subject: [PATCH] handle --noop on docker::image --- manifests/image.pp | 12 +----------- spec/defines/image_spec.rb | 6 +++--- spec/defines/image_windows_spec.rb | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/manifests/image.pp b/manifests/image.pp index 345e3930..f4555118 100644 --- a/manifests/image.pp +++ b/manifests/image.pp @@ -140,17 +140,7 @@ timeout => $exec_timeout, logoutput => true, } - } elsif $ensure == 'latest' or $image_tag == 'latest' { - exec { "echo 'Update of ${image_arg} complete'": - environment => $exec_environment, - path => $exec_path, - timeout => $exec_timeout, - onlyif => $image_install, - require => File[$update_docker_image_path], - provider => $exec_provider, - logoutput => true, - } - } elsif $ensure == 'present' { + } elsif $ensure == 'latest' or $image_tag == 'latest' or $ensure == 'present' { exec { $image_install: unless => $_image_find, environment => $exec_environment, diff --git a/spec/defines/image_spec.rb b/spec/defines/image_spec.rb index 0d029817..6bc22bf1 100644 --- a/spec/defines/image_spec.rb +++ b/spec/defines/image_spec.rb @@ -134,17 +134,17 @@ context 'with ensure => latest' do let(:params) { { 'ensure' => 'latest' } } - it { should contain_exec("echo 'Update of base complete'").with_onlyif('/usr/local/bin/update_docker_image.sh base') } + it { should contain_exec("/usr/local/bin/update_docker_image.sh base") } end context 'with ensure => latest and image_tag => precise' do let(:params) { { 'ensure' => 'latest', 'image_tag' => 'precise' } } - it { should contain_exec("echo 'Update of base:precise complete'") } + it { should contain_exec("/usr/local/bin/update_docker_image.sh base:precise") } end context 'with ensure => latest and image_digest => sha256:deadbeef' do let(:params) { { 'ensure' => 'latest', 'image_digest' => 'sha256:deadbeef' } } - it { should contain_exec("echo 'Update of base@sha256:deadbeef complete'") } + it { should contain_exec("/usr/local/bin/update_docker_image.sh base@sha256:deadbeef") } end context 'with an invalid image name' do diff --git a/spec/defines/image_windows_spec.rb b/spec/defines/image_windows_spec.rb index d0b9c861..f40b4300 100644 --- a/spec/defines/image_windows_spec.rb +++ b/spec/defines/image_windows_spec.rb @@ -44,7 +44,7 @@ context 'with ensure => latest' do let(:params) { { 'ensure' => 'latest' } } - it { should contain_exec("echo 'Update of base complete'").with_onlyif('& C:/Windows/Temp/update_docker_image.ps1 base') } + it { should contain_exec("& C:/Windows/Temp/update_docker_image.ps1 base") } end end \ No newline at end of file