Sha256: 731785db7104a072579cc4878b990a3b154d00c07f86351b733c2ff54dcbb2b8
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
module Nucleon module Action module Node class Revoke < CORL.plugin_class(:nucleon, :cloud_action) #----------------------------------------------------------------------------- # Info def self.describe super(:node, :revoke, 550) end #----------------------------------------------------------------------------- # Settings def configure super do codes :key_remove_failure register :public_key, :str, nil end end #--- def arguments [ :public_key ] end #----------------------------------------------------------------------------- # Operations def execute super do |node, network| info('corl.actions.revoke.start') ensure_node(node) do ssh_path = Util::SSH.key_path authorized_keys = File.join(ssh_path, 'authorized_keys') public_key = settings[:public_key].strip output_keys = [] if File.exists?(authorized_keys) Util::Disk.read(authorized_keys).split("\n").each do |line| if line.strip.include?(public_key) key_found = true else output_keys << public_key end end end unless key_found unless Util::Disk.write(authorized_keys, output_keys.join("\n")) myself.status = code.key_revoke_failure end end end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
corl-0.5.1 | lib/nucleon/action/node/revoke.rb |
corl-0.5.0 | lib/nucleon/action/node/revoke.rb |