Method: Fog::Compute::AWS::KeyPair#write
- Defined in:
- lib/fog/aws/models/compute/key_pair.rb
#write(path = "#{ENV['HOME']}/.ssh/fog_#{Fog.credential.to_s}_#{name}.pem") ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/aws/models/compute/key_pair.rb', line 37 def write(path="#{ENV['HOME']}/.ssh/fog_#{Fog.credential.to_s}_#{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 |