3
3
if fact ( 'kernel' ) == 'windows'
4
4
docker_args = 'docker_ee => true'
5
5
default_image = 'winamd64/hello-seattle'
6
- if fact ( 'os.release.major' ) == '2019'
7
- default_image_tag = 'nanoserver'
8
- else
9
- default_image_tag = 'nanoserver-sac2016'
10
- end
6
+ default_image_tag = if fact ( 'os.release.major' ) == '2019'
7
+ 'nanoserver'
8
+ else
9
+ 'nanoserver-sac2016'
10
+ end
11
11
default_digest = 'sha256:dcba85354678b50608b8c40ec6d17cce063a224aa0e12b6a55dc47b67f039e75'
12
12
second_image = 'winamd64/hola-mundo'
13
13
default_dockerfile = 'C:/Users/Administrator/AppData/Local/Temp/Dockerfile'
18
18
default_docker_run_arg = "restart => 'always', net => 'nat',"
19
19
default_run_command = 'ping 127.0.0.1 -t'
20
20
docker_command = '"/cygdrive/c/Program Files/Docker/docker"'
21
- default_docker_exec_lr_command = 'cmd /c "ping 127.0.0.1 -t > c:\windows\temp \test_file.txt"'
22
- default_docker_exec_command = 'cmd /c "echo test > c:\windows\temp \test_file.txt"'
23
- docker_mount_path = 'C:/Users/Administrator/AppData/Local/Temp '
21
+ default_docker_exec_lr_command = 'cmd /c "ping 127.0.0.1 -t > C:\Users\Public \test_file.txt"'
22
+ default_docker_exec_command = 'cmd /c "echo test > C:\Users\Public \test_file.txt"'
23
+ docker_mount_path = 'C:/Users/Public/DockerVolume '
24
24
storage_driver = 'windowsfilter'
25
25
else
26
26
docker_args = if fact ( 'os.family' ) == 'RedHat'
@@ -317,7 +317,7 @@ class { 'docker': #{docker_args} }
317
317
318
318
it 'creates a new image based on a Dockerfile' do
319
319
run_cmd = if fact ( 'osfamily' ) == 'windows'
320
- 'RUN echo test > C:\\Windows\\Temp \\Dockerfile_test.txt'
320
+ 'RUN echo test > C:\\Users\\Public \\Dockerfile_test.txt'
321
321
else
322
322
"RUN echo test > #{ dockerfile_test } "
323
323
end
@@ -343,7 +343,7 @@ class { 'docker': #{docker_args} }
343
343
# A sleep to give docker time to execute properly
344
344
sleep 4
345
345
if fact ( 'osfamily' ) == 'windows'
346
- shell ( "#{ docker_command } run alpine_with_file cmd /c dir Windows \\ \\ Temp " ) do |r |
346
+ shell ( "#{ docker_command } run alpine_with_file cmd /c dir Users \\ \\ Public " ) do |r |
347
347
expect ( r . stdout ) . to match ( %r{_test.txt} )
348
348
end
349
349
else
@@ -471,7 +471,7 @@ class { 'docker': #{docker_args}
471
471
472
472
container_id = shell ( "#{ docker_command } ps | awk 'FNR == 2 {print $1}'" )
473
473
if fact ( 'osfamily' ) == 'windows'
474
- shell ( "#{ docker_command } exec #{ container_id . stdout . strip } cmd /c dir Windows \\ \\ Temp " ) do |r |
474
+ shell ( "#{ docker_command } exec #{ container_id . stdout . strip } cmd /c dir Users \\ \\ Public " ) do |r |
475
475
expect ( r . stdout ) . to match ( %r{test_file.txt} )
476
476
end
477
477
else
@@ -559,6 +559,11 @@ class { 'docker': #{docker_args} }
559
559
#{ default_docker_run_arg }
560
560
}
561
561
562
+ file { '#{ docker_mount_path } ':
563
+ ensure => directory,
564
+ before => File['#{ docker_mount_path } /test_mount.txt'],
565
+ }
566
+
562
567
file { '#{ docker_mount_path } /test_mount.txt':
563
568
ensure => present,
564
569
before => Docker::Run['container_3_4'],
@@ -572,7 +577,7 @@ class { 'docker': #{docker_args} }
572
577
sleep 4
573
578
container_id = shell ( "#{ docker_command } ps | awk 'FNR == 2 {print $1}'" )
574
579
if fact ( 'osfamily' ) == 'windows'
575
- shell ( "#{ docker_command } exec #{ container_id . stdout . strip } cmd /c dir Users\\ \\ Administrator \\ \\ AppData \\ \\ Local \\ \\ Temp \\ \\ mnt" ) do |r |
580
+ shell ( "#{ docker_command } exec #{ container_id . stdout . strip } cmd /c dir Users\\ \\ Public \\ \\ DockerVolume \\ \\ mnt" ) do |r |
576
581
expect ( r . stdout ) . to match ( %r{test_mount.txt} )
577
582
end
578
583
else
@@ -878,7 +883,7 @@ class { 'docker': #{docker_args} }
878
883
879
884
container_id = shell ( "#{ docker_command } ps | awk 'FNR == 2 {print $1}'" )
880
885
if fact ( 'osfamily' ) == 'windows'
881
- shell ( "#{ docker_command } exec #{ container_id . stdout . strip } cmd /c dir Windows \\ \\ Temp " ) do |r |
886
+ shell ( "#{ docker_command } exec #{ container_id . stdout . strip } cmd /c dir Users \\ \\ Public " ) do |r |
882
887
expect ( r . stdout ) . to match ( %r{test_file.txt} )
883
888
end
884
889
else
@@ -916,7 +921,7 @@ class { 'docker': #{docker_args} }
916
921
sleep 4
917
922
918
923
if fact ( 'osfamily' ) == 'windows'
919
- shell ( "#{ docker_command } exec #{ container_name } cmd /c dir Windows \\ \\ Temp " ) do |r |
924
+ shell ( "#{ docker_command } exec #{ container_name } cmd /c dir Users \\ \\ Public " ) do |r |
920
925
expect ( r . stdout ) . not_to match ( %r{test_file.txt} )
921
926
end
922
927
else
@@ -948,7 +953,7 @@ class { 'docker': #{docker_args} }
948
953
sleep 4
949
954
950
955
if fact ( 'osfamily' ) == 'windows'
951
- shell ( "#{ docker_command } exec #{ container_name } cmd /c dir Windows \\ \\ Temp " ) do |r |
956
+ shell ( "#{ docker_command } exec #{ container_name } cmd /c dir Users \\ \\ Public " ) do |r |
952
957
expect ( r . stdout ) . to match ( %r{test_file.txt} )
953
958
end
954
959
else
0 commit comments