Class: Nucleon::Action::Node::Revoke
- Inherits:
-
Object
- Object
- Nucleon::Action::Node::Revoke
- Defined in:
- lib/nucleon/action/node/revoke.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
-
#arguments ⇒ Object
—.
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Operations.
Class Method Details
.describe ⇒ Object
Info
10 11 12 |
# File 'lib/nucleon/action/node/revoke.rb', line 10 def self.describe super(:node, :revoke, 550) end |
Instance Method Details
#arguments ⇒ Object
27 28 29 |
# File 'lib/nucleon/action/node/revoke.rb', line 27 def arguments [ :public_key ] end |
#configure ⇒ Object
Settings
17 18 19 20 21 22 23 |
# File 'lib/nucleon/action/node/revoke.rb', line 17 def configure super do codes :key_remove_failure register :public_key, :str, nil end end |
#execute ⇒ Object
Operations
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/nucleon/action/node/revoke.rb', line 34 def execute super do |node| info('corl.actions.revoke.start') ensure_node(node) do ssh_path = Util::SSH.key_path = File.join(ssh_path, 'authorized_keys') public_key = settings[:public_key].strip output_keys = [] if File.exists?() Util::Disk.read().split("\n").each do |line| if line.strip.include?(public_key) key_found = true else output_keys << line end end end unless key_found unless Util::Disk.write(, output_keys.join("\n")) myself.status = code.key_revoke_failure end end end end end |