Method: Fog::OpenStack::Compute::KeyPair#write
- Defined in:
- lib/fog/openstack/compute/models/key_pair.rb
#write(path = "#{ENV['HOME']}/.ssh/fog_#{Fog.credential}_#{name}.pem") ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fog/openstack/compute/models/key_pair.rb', line 37 def write(path = "#{ENV['HOME']}/.ssh/fog_#{Fog.credential}_#{name}.pem") if writable? split_private_key = private_key.split(/\n/) File.open(path, "w") do |f| split_private_key.each { |line| f.puts line } f.chmod 0600 end "Key file built: #{path}" else "Invalid private key" end end |