Skip to content

Commit 3a60014

Browse files
glorpendavejrt
authored andcommitted
Revert "removed $::docker::run::detach parameter" (#400)
This reverts commit f5de8ac.
1 parent 122f385 commit 3a60014

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ This is equivalent to running the `docker run -d base /bin/sh -c "while true; d
332332
```puppet
333333
docker::run { 'helloworld':
334334
image => 'base',
335+
detach => true,
335336
service_prefix => 'docker-',
336337
command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
337338
ports => ['4444', '4555'],

Diff for: manifests/run.pp

+7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
Variant[String,Boolean] $docker_service = false,
110110
Optional[Boolean] $disable_network = false,
111111
Optional[Boolean] $privileged = false,
112+
Optional[Boolean] $detach = undef,
112113
Variant[String,Array[String],Undef] $extra_parameters = undef,
113114
Optional[String] $systemd_restart = 'on-failure',
114115
Variant[String,Hash,Undef] $extra_systemd_parameters = {},
@@ -169,6 +170,12 @@
169170
assert_type(Pattern[/^(no|always|on-success|on-failure|on-abnormal|on-abort|on-watchdog)$/], $systemd_restart)
170171
}
171172

173+
if $detach == undef {
174+
$valid_detach = $docker::params::detach_service_in_init
175+
} else {
176+
$valid_detach = $detach
177+
}
178+
172179
$extra_parameters_array = any2array($extra_parameters)
173180
$after_array = any2array($after)
174181
$depends_array = any2array($depends)

Diff for: spec/defines/run_spec.rb

+5
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@
379379
end
380380
end
381381

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+
382387
context 'when running with a tty' do
383388
let(:params) { {'command' => 'command', 'image' => 'base', 'tty' => true} }
384389
it { should contain_file(startscript_or_init).with_content(/-t/) }

0 commit comments

Comments
 (0)