Method: Chef::ApiClient::Registration#write_key

Defined in:
lib/chef/api_client/registration.rb

#write_keyObject



87
88
89
90
91
92
93
# File 'lib/chef/api_client/registration.rb', line 87

def write_key
  ::File.open(destination, file_flags, 0600) do |f|
    f.print(private_key)
  end
rescue IOError => e
  raise Chef::Exceptions::CannotWritePrivateKey, "Error writing private key to #{destination}: #{e}"
end