Sha256: a09e5e70b6765ba755d65b3d163dccf3f570212fe905109b3ded11492d472cf0

Contents?: true

Size: 473 Bytes

Versions: 2

Compression:

Stored size: 473 Bytes

Contents

class Bosh::Bootstrap::KeyPair
  include FileUtils

  attr_reader :base_path, :keyname, :private_key

  def initialize(base_path, keyname, private_key)
    @base_path, @keyname, @private_key = base_path, keyname, private_key
  end

  def execute!
    mkdir_p(File.dirname(path))
    chmod(0700, File.dirname(path))

    File.open(path, "w") { |file| file << private_key }
    chmod(0600, path)
  end

  def path
    @path ||= File.join(base_path, "ssh", keyname)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bosh-bootstrap-0.11.1 lib/bosh-bootstrap/key_pair.rb
bosh-bootstrap-0.11.0 lib/bosh-bootstrap/key_pair.rb