Skip to content

Commit 7537958

Browse files
davejrtscotty-c
authored andcommitted
fixing issue #21 (#36)
* fixing issue #21 * linting
1 parent 2c4c0e4 commit 7537958

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

manifests/services.pp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# == Define: docker::services
2-
#
3-
# A define that managers a Docker services
2+
#
3+
# A define that managers a Docker services
44
#
55
# == Paramaters
66
#
7-
# [*ensure*]
7+
# [*ensure*]
88
# This ensures that the service is present or not.
99
# Defaults to present
1010
#
11-
# [*image*]
12-
# The Docker image to spwan the service from.
13-
# Defualts to undef
11+
# [*image*]
12+
# The Docker image to spwan the service from.
13+
# Defualts to undef
1414
#
15-
# [*detach*]
15+
# [*detach*]
1616
# Exit immediately instead of waiting for the service to converge (default true)
1717
# Defaults to true
1818
#
@@ -30,9 +30,9 @@
3030
# Defaults to undef
3131
#
3232
# [*replicas*]
33-
# Number of tasks (containers per service)
33+
# Number of tasks (containers per service)
3434
# defaults to undef
35-
#
35+
#
3636
# [*tty*]
3737
# Allocate a pseudo-TTY
3838
# Defaults to false
@@ -51,14 +51,14 @@
5151
# defaults to []
5252
#
5353
# [*update*]
54-
# This changes the docker command to
55-
# docker service update, you must pass a service name with this option
54+
# This changes the docker command to
55+
# docker service update, you must pass a service name with this option
5656
#
5757
# [*scale*]
5858
# This changes the docker command to
59-
# docker service scale, this can only be used with service name and
59+
# docker service scale, this can only be used with service name and
6060
# replicas
61-
#
61+
#
6262
# [*host_socket*]
6363
# This will allow the service to connect to the host linux socket.
6464
# defaults to undef
@@ -154,6 +154,7 @@
154154
workdir => $workdir,
155155
extra_params => any2array($extra_params),
156156
image => $image,
157+
host_socket => $host_socket,
157158
})
158159

159160
$exec_update = "${docker_command} update ${docker_service_flags}"
@@ -173,7 +174,7 @@
173174
extra_params => any2array($extra_params),
174175
})
175176

176-
$exec_scale = "${docker_command} scale ${docker_service_flags}"
177+
$exec_scale = "${docker_command} scale ${service_name}=${replicas}"
177178

178179
exec { 'Docker service scale':
179180
command => $exec_scale,
@@ -191,3 +192,4 @@
191192
}
192193
}
193194
}
195+

spec/defines/services_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
'image' => 'foo:bar',
1919
'publish' => '80:80',
2020
'replicas' => '5',
21-
'extra_params' => ['--update-delay 1m', '--restart-window 30s']
21+
'extra_params' => ['--update-delay 1m', '--restart-window 30s']
2222
} }
2323
it { is_expected.to compile.with_all_deps }
2424
it { should contain_exec('Docker service create').with_command(/docker service create/) }
@@ -28,24 +28,24 @@
2828
let(:params) { {
2929
'create' => false,
3030
'update' => true,
31-
'service_name' => 'foo',
31+
'service_name' => 'foo',
3232
'image' => 'bar:latest',
3333
} }
3434
it { is_expected.to compile.with_all_deps }
3535
it { should contain_exec('Docker service update').with_command(/docker service update/) }
3636
end
37-
37+
3838
context 'with ensure => present and service scale' do
3939
let(:params) { {
4040
'create' => false,
4141
'scale' => true,
42-
'service_name' => 'bar',
42+
'service_name' => 'bar',
4343
'replicas' => '5',
4444
} }
4545
it { is_expected.to compile.with_all_deps }
4646
it { should contain_exec('Docker service scale').with_command(/docker service scale/) }
4747
end
48-
48+
4949
context 'with ensure => absent' do
5050
let(:params) { {
5151
'ensure' => 'absent',

0 commit comments

Comments
 (0)