Skip to content
Open
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
1 change: 0 additions & 1 deletion plugins/providers/virtualbox/cap/mount_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def self.mount_options(machine, name, guest_path, options)

mount_options << "uid=#{mount_uid}"
mount_options << "gid=#{mount_gid}"
mount_options << "_netdev"
mount_options = mount_options.join(',')
return mount_options, mount_uid, mount_gid
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
let(:mount_owner){ 2000 }
it "generates the expected mount command using mount_owner directly" do
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options)
expect(out_mount_options).to eq("uid=#{mount_owner},gid=#{mount_gid},_netdev")
expect(out_mount_options).to eq("uid=#{mount_owner},gid=#{mount_gid}")
expect(out_mount_uid).to eq(mount_owner)
expect(out_mount_gid).to eq(mount_gid)
end
Expand All @@ -62,7 +62,7 @@
let(:mount_owner){ "2000" }
it "generates the expected mount command using mount_owner directly" do
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options)
expect(out_mount_options).to eq("uid=#{mount_owner},gid=#{mount_gid},_netdev")
expect(out_mount_options).to eq("uid=#{mount_owner},gid=#{mount_gid}")
expect(out_mount_uid).to eq(mount_owner)
expect(out_mount_gid).to eq(mount_gid)
end
Expand All @@ -81,7 +81,7 @@

it "generates the expected mount command using mount_group directly" do
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options)
expect(out_mount_options).to eq("uid=#{mount_uid},gid=#{mount_group},_netdev")
expect(out_mount_options).to eq("uid=#{mount_uid},gid=#{mount_group}")
expect(out_mount_uid).to eq(mount_uid)
expect(out_mount_gid).to eq(mount_group)
end
Expand All @@ -92,7 +92,7 @@

it "generates the expected mount command using mount_group directly" do
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options)
expect(out_mount_options).to eq("uid=#{mount_uid},gid=#{mount_group},_netdev")
expect(out_mount_options).to eq("uid=#{mount_uid},gid=#{mount_group}")
expect(out_mount_uid).to eq(mount_uid)
expect(out_mount_gid).to eq(mount_group)
end
Expand All @@ -106,7 +106,7 @@
expect(comm).to receive(:execute).with("getent group #{mount_group}", anything).and_raise(Vagrant::Errors::VirtualBoxMountFailed, {command: '', output: ''})
expect(comm).to receive(:execute).with("id -g #{mount_owner}", anything).and_yield(:stdout, "1").and_return(0)
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options)
expect(out_mount_options).to eq("uid=#{mount_uid},gid=1,_netdev")
expect(out_mount_options).to eq("uid=#{mount_uid},gid=1")
end
end

Expand All @@ -125,7 +125,7 @@
expect(comm).to receive(:execute).with("id -u #{mount_owner}", anything).and_yield(:stdout, mount_uid)
expect(comm).to receive(:execute).with("getent group #{mount_group}", anything).and_yield(:stdout, "vagrant:x:#{mount_gid}:")
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options.merge(mount_options: ["ro"]))
expect(out_mount_options).to eq("ro,uid=#{mount_uid},gid=#{mount_gid},_netdev")
expect(out_mount_options).to eq("ro,uid=#{mount_uid},gid=#{mount_gid}")
expect(out_mount_uid).to eq(mount_uid)
expect(out_mount_gid).to eq(mount_gid)
end
Expand All @@ -144,7 +144,7 @@
expect(comm).not_to receive(:execute).with("id -u #{mount_owner}", anything).and_yield(:stdout, mount_uid)
expect(comm).to receive(:execute).with("getent group #{mount_group}", anything).and_yield(:stdout, "vagrant:x:#{mount_gid}:")
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options.merge(mount_options: ["uid=#{options_uid}"]) )
expect(out_mount_options).to eq("uid=#{options_uid},gid=#{mount_gid},_netdev")
expect(out_mount_options).to eq("uid=#{options_uid},gid=#{mount_gid}")
expect(out_mount_uid).to eq(options_uid)
expect(out_mount_gid).to eq(mount_gid)
end
Expand All @@ -157,7 +157,7 @@
expect(comm).to receive(:execute).with("id -u #{mount_owner}", anything).and_yield(:stdout, mount_uid)
expect(comm).not_to receive(:execute).with("getent group #{mount_group}", anything).and_yield(:stdout, "vagrant:x:#{mount_gid}:")
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options.merge(mount_options: ["gid=#{options_gid}"]) )
expect(out_mount_options).to eq("uid=#{mount_uid},gid=#{options_gid},_netdev")
expect(out_mount_options).to eq("uid=#{mount_uid},gid=#{options_gid}")
expect(out_mount_uid).to eq(mount_uid)
expect(out_mount_gid).to eq(options_gid)
end
Expand All @@ -171,7 +171,7 @@
expect(comm).not_to receive(:execute).with("id -u #{mount_owner}", anything).and_yield(:stdout, mount_uid)
expect(comm).not_to receive(:execute).with("getent group #{mount_group}", anything).and_yield(:stdout, "vagrant:x:#{options_gid}:")
out_mount_options, out_mount_uid, out_mount_gid = cap.mount_options(machine, mount_name, mount_guest_path, folder_options.merge(mount_options: ["uid=#{options_uid}", "gid=#{options_gid}"]) )
expect(out_mount_options).to eq("uid=#{options_uid},gid=#{options_gid},_netdev")
expect(out_mount_options).to eq("uid=#{options_uid},gid=#{options_gid}")
expect(out_mount_uid).to eq(options_uid)
expect(out_mount_gid).to eq(options_gid)
end
Expand Down