Merge pull request #9754 from briancain/DOCKER-PROV-WINDOWS
Update docker provisioner for windows, fix command filter behavior for `rm`
This commit is contained in:
commit
6fc2d9d82d
|
@ -31,9 +31,9 @@ module VagrantPlugins
|
|||
|
||||
ret_cmd = ''
|
||||
if recurse
|
||||
ret_cmd = "rm \"#{dir}\" -recurse -force"
|
||||
ret_cmd = "if (Test-Path \"#{dir}\") {Remove-Item \"#{dir}\" -force -recurse}"
|
||||
else
|
||||
ret_cmd = "rm \"#{dir}\" -force"
|
||||
ret_cmd = "if (Test-Path \"#{dir}\") {Remove-Item \"#{dir}\" -force}"
|
||||
end
|
||||
return ret_cmd
|
||||
end
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
module VagrantPlugins
|
||||
module DockerProvisioner
|
||||
module Cap
|
||||
module Windows
|
||||
module DockerDaemonRunning
|
||||
def self.docker_daemon_running(machine)
|
||||
machine.communicate.test("tasklist | find \"`\"dockerd`\"\"")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -127,12 +127,9 @@ module VagrantPlugins
|
|||
def create_container(config)
|
||||
args = container_run_args(config)
|
||||
|
||||
@machine.communicate.sudo %[
|
||||
rm -f #{config[:cidfile]}
|
||||
docker run #{args}
|
||||
]
|
||||
@machine.communicate.sudo %[rm -f "#{config[:cidfile]}"]
|
||||
@machine.communicate.sudo %[docker run #{args}]
|
||||
|
||||
name = container_name(config)
|
||||
sha = Digest::SHA1.hexdigest(args)
|
||||
container_data_path(config).open("w+") do |f|
|
||||
f.write(sha)
|
||||
|
|
|
@ -54,6 +54,11 @@ module VagrantPlugins
|
|||
Cap::Linux::DockerDaemonRunning
|
||||
end
|
||||
|
||||
guest_capability("windows", "docker_daemon_running") do
|
||||
require_relative "cap/windows/docker_daemon_running"
|
||||
Cap::Windows::DockerDaemonRunning
|
||||
end
|
||||
|
||||
provisioner(:docker) do
|
||||
require_relative "provisioner"
|
||||
Provisioner
|
||||
|
|
|
@ -54,22 +54,22 @@ describe VagrantPlugins::CommunicatorWinRM::CommandFilter, unit: true do
|
|||
|
||||
it 'filters out rm recurse commands' do
|
||||
expect(subject.filter('rm -Rf /some/dir')).to eq(
|
||||
"rm \"/some/dir\" -recurse -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force -recurse}")
|
||||
expect(subject.filter('rm -fr /some/dir')).to eq(
|
||||
"rm \"/some/dir\" -recurse -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force -recurse}")
|
||||
expect(subject.filter('rm -r /some/dir')).to eq(
|
||||
"rm \"/some/dir\" -recurse -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force -recurse}")
|
||||
expect(subject.filter('rm -r "/some/dir"')).to eq(
|
||||
"rm \"/some/dir\" -recurse -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force -recurse}")
|
||||
end
|
||||
|
||||
it 'filters out rm commands' do
|
||||
expect(subject.filter('rm /some/dir')).to eq(
|
||||
"rm \"/some/dir\" -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force}")
|
||||
expect(subject.filter('rm -f /some/dir')).to eq(
|
||||
"rm \"/some/dir\" -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force}")
|
||||
expect(subject.filter('rm -f "/some/dir"')).to eq(
|
||||
"rm \"/some/dir\" -force")
|
||||
"if (Test-Path \"/some/dir\") {Remove-Item \"/some/dir\" -force}")
|
||||
end
|
||||
|
||||
it 'filters out mkdir commands' do
|
||||
|
|
Loading…
Reference in New Issue