73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/chef/api_client/registration.rb', line 73
def assert_destination_writable!
abs_path = File.expand_path(destination)
unless File.exist?(File.dirname(abs_path))
begin
FileUtils.mkdir_p(File.dirname(abs_path))
rescue Errno::EACCES
raise Chef::Exceptions::CannotWritePrivateKey, "I can't create the configuration directory at #{File.dirname(abs_path)} - check permissions?"
end
end
if (File.exist?(abs_path) && !File.writable?(abs_path)) || !File.writable?(File.dirname(abs_path))
raise Chef::Exceptions::CannotWritePrivateKey, "I can't write your private key to #{abs_path} - check permissions?"
end
end
|