Merge pull request #9769 from chrisroberts/e-key-perms
Log error and proceed when private key permissions fail
This commit is contained in:
commit
40ae8aa38d
|
@ -196,8 +196,13 @@ module VagrantPlugins
|
|||
|
||||
# Adjust private key file permissions
|
||||
if Vagrant::Util::Platform.windows?
|
||||
priv_path = @machine.data_dir.join("private_key").to_s
|
||||
File.set_permissions(priv_path, Etc.getlogin => File::FULL)
|
||||
begin
|
||||
priv_path = @machine.data_dir.join("private_key").to_s
|
||||
File.set_permissions(priv_path, Etc.getlogin => File::FULL)
|
||||
rescue => e
|
||||
@logger.warn("Error encountered during private key permissions set - " \
|
||||
"#{e.class}: #{e.message}")
|
||||
end
|
||||
else
|
||||
@machine.data_dir.join("private_key").chmod(0600)
|
||||
end
|
||||
|
|
|
@ -231,6 +231,10 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
|||
expect(File).to receive(:set_permissions).with("PRIVATE_KEY_PATH", any_args)
|
||||
end
|
||||
|
||||
it "should proceed when error is encountered" do
|
||||
expect(File).to receive(:set_permissions).and_raise(StandardError)
|
||||
end
|
||||
|
||||
context "with multiple permissions on file" do
|
||||
|
||||
it "should delete all non-owner permissions" do
|
||||
|
|
Loading…
Reference in New Issue