Class: Composer::Verify::Key
- Inherits:
-
Object
- Object
- Composer::Verify::Key
- Defined in:
- lib/composer/verify/key.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Key
constructor
A new instance of Key.
- #verify(args) ⇒ Object
Constructor Details
#initialize(args) ⇒ Key
Returns a new instance of Key.
4 5 6 7 8 |
# File 'lib/composer/verify/key.rb', line 4 def initialize(args) @config = args[:config] @region = @config.region @logger = @config.logger end |
Instance Method Details
#verify(args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/composer/verify/key.rb', line 10 def verify(args) key = args[:key] key_pairs = ec2.key_pairs.entries.map { |k| k.name } @logger.debug "Check for key_pairs in #{@region}." @logger.debug "Existing keypairs: #{key_pairs.join ', '}" unless key_pairs.include? key raise InvalidKeyPair.new "Key #{key} does not exist in #{@region}." end end |