Skip to content

Commit 25680ed

Browse files
committed
Add root_dir in daemon.json
1 parent e6666cf commit 25680ed

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

spec/acceptance/docker_spec.rb

+18-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
raise 'Could not retrieve ip address for Windows box' if result.exit_code != 0
1010
ip = result.stdout.split("\n")[0].split(':')[1].strip
1111
@windows_ip = ip
12-
docker_arg = "docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]'"
12+
docker_args = "docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]', root_dir => 'C:/Users/Administrator/AppData/Local/Temp'
13+
"
1314
docker_registry_image = 'stefanscherer/registry-windows'
1415
docker_network = 'nat'
1516
registry_host = @windows_ip
1617
config_file = '/cygdrive/c/Users/Administrator/.docker/config.json'
17-
root_dir = 'C:/Users/Administrator/AppData/Local/Temp'
1818
server_strip = "#{registry_host}_#{registry_port}"
1919
bad_server_strip = "#{registry_host}_5001"
2020
broken = true
@@ -35,6 +35,7 @@
3535
root_dir = '/root'
3636
end
3737

38+
3839
describe 'docker' do
3940
package_name = 'docker-ce'
4041
service_name = 'docker'
@@ -43,12 +44,25 @@
4344
context 'When adding system user', win_broken: broken do
4445
let(:pp) do
4546
"
46-
class { 'docker': #{docker_arg}
47+
class { 'docker': #{docker_args}
4748
docker_users => ['user1']
4849
}
4950
"
5051
end
5152

53+
context 'Checking root_dir value' do
54+
let(:pp) do
55+
"class { 'docker': #{docker_args}}"
56+
end
57+
58+
it 'is good' do
59+
apply_manifest(pp, catch_failures: true)
60+
run_shell('cat C:/ProgramData/docker/config/daemon.json') do |r|
61+
expect(r.stdout).to match(%r{data-root})
62+
end
63+
end
64+
end
65+
5266
it 'the docker daemon' do
5367
apply_manifest(pp, catch_failures: true) do |r|
5468
expect(r.stdout).not_to match(%r{docker-systemd-reload-before-service})
@@ -177,7 +191,7 @@ class { 'docker':
177191

178192
it 'is able to run registry' do
179193
pp = <<-MANIFEST
180-
class { 'docker': #{docker_arg}}
194+
class { 'docker': #{docker_args}}
181195
docker::run { 'registry':
182196
image => '#{docker_registry_image}',
183197
pull_on_start => true,

templates/windows/config/daemon.json.erb

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<% if @extra_parameters %><% @extra_parameters_array.each do |param| %>
1818
<%= param %> ,<% end %>
1919
<% end -%>
20+
<% if @root_dir %>"data-root": "<%= @root_dir %>",<% end -%>
2021
"labels": <%= @labels_array.to_json %>
2122
}

0 commit comments

Comments
 (0)