Sha256: 2e2343a0a6bb121938392d596e557da6ae7a1c2d6c89466e17ad95c1d4d8d113
Contents?: true
Size: 600 Bytes
Versions: 2
Compression:
Stored size: 600 Bytes
Contents
module Shelly class SshKey < Model attr_reader :path def initialize(path) @path = File.expand_path(path) end def exists? File.exists?(path) end def destroy shelly.delete_ssh_key(fingerprint) if exists? end def upload shelly.add_ssh_key(key) end def uploaded? return false unless exists? shelly.ssh_key(fingerprint) true rescue Shelly::Client::NotFoundException false end def fingerprint `ssh-keygen -lf #{path}`.split(" ")[1] end def key File.read(path) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shelly-0.4.16 | lib/shelly/ssh_key.rb |
shelly-0.4.15 | lib/shelly/ssh_key.rb |