Always remove credentials file after mount attempts
This commit is contained in:
parent
eae5230b5d
commit
e85ef1655b
|
@ -46,7 +46,7 @@ SCRIPT
|
||||||
|
|
||||||
# Attempt to mount the folder. We retry here a few times because
|
# Attempt to mount the folder. We retry here a few times because
|
||||||
# it can fail early on.
|
# it can fail early on.
|
||||||
|
begin
|
||||||
retryable(on: Vagrant::Errors::LinuxMountFailed, tries: 10, sleep: 2) do
|
retryable(on: Vagrant::Errors::LinuxMountFailed, tries: 10, sleep: 2) do
|
||||||
no_such_device = false
|
no_such_device = false
|
||||||
stderr = ""
|
stderr = ""
|
||||||
|
@ -63,6 +63,11 @@ SCRIPT
|
||||||
output: stderr
|
output: stderr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
# Always remove credentials file after mounting attempts
|
||||||
|
# have been completed
|
||||||
|
machine.communicate.sudo("rm /etc/smb_creds_#{name}")
|
||||||
|
end
|
||||||
|
|
||||||
emit_upstart_notification(machine, expanded_guest_path)
|
emit_upstart_notification(machine, expanded_guest_path)
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,6 +63,11 @@ describe "VagrantPlugins::GuestLinux::Cap::MountSMBSharedFolder" do
|
||||||
cap.mount_smb_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
cap.mount_smb_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "removes the credentials file before completion" do
|
||||||
|
expect(comm).to receive(:sudo).with(/rm.+smb_creds_.+/)
|
||||||
|
cap.mount_smb_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
||||||
|
end
|
||||||
|
|
||||||
it "sends upstart notification after mount" do
|
it "sends upstart notification after mount" do
|
||||||
expect(comm).to receive(:sudo).with(/emit/)
|
expect(comm).to receive(:sudo).with(/emit/)
|
||||||
cap.mount_smb_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
cap.mount_smb_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
||||||
|
|
Loading…
Reference in New Issue