File tree 3 files changed +13
-0
lines changed
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,7 @@ This is equivalent to running the `docker run -d base /bin/sh -c "while true; d
332
332
``` puppet
333
333
docker::run { 'helloworld':
334
334
image => 'base',
335
+ detach => true,
335
336
service_prefix => 'docker-',
336
337
command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
337
338
ports => ['4444', '4555'],
Original file line number Diff line number Diff line change 109
109
Variant[String,Boolean] $docker_service = false ,
110
110
Optional[Boolean] $disable_network = false ,
111
111
Optional[Boolean] $privileged = false ,
112
+ Optional[Boolean] $detach = undef ,
112
113
Variant[String,Array[String],Undef ] $extra_parameters = undef ,
113
114
Optional[String] $systemd_restart = ' on-failure' ,
114
115
Variant[String,Hash,Undef ] $extra_systemd_parameters = {},
169
170
assert_type(Pattern[/^(no|always|on-success|on-failure|on-abnormal|on-abort|on-watchdog)$/], $systemd_restart )
170
171
}
171
172
173
+ if $detach == undef {
174
+ $valid_detach = $docker::params::detach_service_in_init
175
+ } else {
176
+ $valid_detach = $detach
177
+ }
178
+
172
179
$extra_parameters_array = any2array($extra_parameters )
173
180
$after_array = any2array($after )
174
181
$depends_array = any2array($depends )
Original file line number Diff line number Diff line change 379
379
end
380
380
end
381
381
382
+ context 'should be able to override detached' do
383
+ let ( :params ) { { 'command' => 'command' , 'image' => 'base' , 'detach' => false } }
384
+ it { should contain_file ( startscript_or_init ) . without_content ( /--detach=true/ ) }
385
+ end
386
+
382
387
context 'when running with a tty' do
383
388
let ( :params ) { { 'command' => 'command' , 'image' => 'base' , 'tty' => true } }
384
389
it { should contain_file ( startscript_or_init ) . with_content ( /-t/ ) }
You can’t perform that action at this time.
0 commit comments