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
|
# Adjust private key file permissions
|
||||||
if Vagrant::Util::Platform.windows?
|
if Vagrant::Util::Platform.windows?
|
||||||
priv_path = @machine.data_dir.join("private_key").to_s
|
begin
|
||||||
File.set_permissions(priv_path, Etc.getlogin => File::FULL)
|
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
|
else
|
||||||
@machine.data_dir.join("private_key").chmod(0600)
|
@machine.data_dir.join("private_key").chmod(0600)
|
||||||
end
|
end
|
||||||
|
|
|
@ -231,6 +231,10 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||||
expect(File).to receive(:set_permissions).with("PRIVATE_KEY_PATH", any_args)
|
expect(File).to receive(:set_permissions).with("PRIVATE_KEY_PATH", any_args)
|
||||||
end
|
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
|
context "with multiple permissions on file" do
|
||||||
|
|
||||||
it "should delete all non-owner permissions" do
|
it "should delete all non-owner permissions" do
|
||||||
|
|
Loading…
Reference in New Issue