Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass docker exec_options to executor as kwargs #13488

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/providers/docker/command/exec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def exec_command(machine, command, options)
Vagrant::Util::SafeExec.exec(exec_cmd[0], *exec_cmd[1..-1])
else
output = ""
machine.provider.driver.execute(*exec_cmd, exec_options) do |type, data|
machine.provider.driver.execute(*exec_cmd, **exec_options) do |type, data|
output += data
end

Expand Down
11 changes: 11 additions & 0 deletions test/unit/plugins/providers/docker/command/exec_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@
subject.exec_command(machine, command, options)
end
end
describe "with options" do
let(:command) { ["ls"] }
let(:options) { {etc: "something"} }

it "passes the options successfully" do
driver = instance_double("Driver")
expect(driver).to receive(:execute).with("docker", "exec", nil, "ls", {etc: "something"})
allow(machine.provider).to receive(:driver) { driver }
subject.exec_command(machine, command, options)
end
end
describe "without a command" do
let(:argv) { [] }

Expand Down