Class: Exos::Commands::Keys

Inherits:
Command
  • Object
show all
Defined in:
lib/exos/commands/keys.rb

Defined Under Namespace

Classes: AuthorizedKeys, Bastions, Key

Constant Summary collapse

PATTERN_KEY_LINE =
/ssh-rsa/
PATTERN_ATTRS_LINE =
/\A### exos-key (.*)/
LOCKFILE_NAME =
"exos.keys.lock"

Instance Attribute Summary

Attributes inherited from Command

#args, #options

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Exos::Commands::Command

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/exos/commands/keys.rb', line 28

def run
  authorized_keys.backup!
  Bastions.role = options.role

  if email = options.grant
    add_key(email)
  elsif email = options.revoke
    remove_key(email, options.delete)
  else
    print_keys_list
  end
end