File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ You can trigger a rebuild of the image by subscribing to external events like Do
238
238
docker::image { 'ubuntu':
239
239
docker_file => '/tmp/Dockerfile'
240
240
subscribe => File['/tmp/Dockerfile'],
241
+ ensure => 'latest',
242
+ refreshonly => 'true'
241
243
}
242
244
243
245
file { '/tmp/Dockerfile':
Original file line number Diff line number Diff line change 32
32
$docker_file = undef ,
33
33
$docker_dir = undef ,
34
34
$docker_tar = undef ,
35
+ $refreshonly = false
35
36
) {
36
37
include docker::params
37
38
$docker_command = $docker::params::docker_command
117
118
timeout => 0,
118
119
onlyif => $image_install ,
119
120
require => File [' /usr/local/bin/update_docker_image.sh' ],
121
+ refreshonly => $refreshonly
120
122
}
121
123
} elsif $ensure == ' present' {
122
124
exec { $image_install:
125
127
path => [' /bin' , ' /usr/bin' ],
126
128
timeout => 0,
127
129
returns => [' 0' , ' 2' ],
128
- require => File [' /usr/local/bin/update_docker_image.sh' ],
130
+ require => File [' /usr/local/bin/update_docker_image.sh' ]
129
131
}
130
132
}
131
133
Original file line number Diff line number Diff line change 32
32
it { should contain_exec ( '/usr/local/bin/update_docker_image.sh base' ) }
33
33
end
34
34
35
+
35
36
context 'with docker_file => Dockerfile' do
36
37
let ( :params ) { { 'docker_file' => 'Dockerfile' } }
37
38
it { should contain_exec ( 'docker build -t base - < Dockerfile' ) }
138
139
139
140
context 'with ensure => latest' do
140
141
let ( :params ) { { 'ensure' => 'latest' } }
141
- it { should contain_exec ( "echo 'Update of base complete'" ) . with_onlyif ( '/usr/local/bin/update_docker_image.sh base' ) }
142
+ it { should contain_exec ( "echo 'Update of base complete'" ) . with_onlyif ( '/usr/local/bin/update_docker_image.sh base' ) . with (
143
+ 'refreshonly' => 'false'
144
+ ) }
145
+ end
146
+
147
+ context 'with ensure => latest and refreshonly = true' do
148
+ let ( :params ) { { 'ensure' => 'latest' , 'refreshonly' => 'true' } }
149
+ it { should contain_exec ( "echo 'Update of base complete'" ) . with_onlyif ( '/usr/local/bin/update_docker_image.sh base' ) . with (
150
+ 'refreshonly' => 'true'
151
+ ) }
142
152
end
143
153
144
154
context 'with ensure => latest and image_tag => precise' do
You can’t perform that action at this time.
0 commit comments