1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[AWS] Setup a fog keypair only if not supplied.

When calling bootstrap, the :key_name argument is currently ignored
and not passed to the internal _setup_bootstrap() method. This results
in fog creating a keypair and using it for the instance.

The additional parameter -- new_attributes -- is also never actually
used when calling _setup_bootstrap().

The patch removes the new_attributes parameter and uses the key_name
attribute of the passed server object to ascertain whether a default
fog keypair should be created.
This commit is contained in:
Timur Alperovich 2014-09-25 16:08:49 -07:00
parent 1c96d0cabd
commit 1401a8723a

View file

@ -175,8 +175,8 @@ module Fog
private private
def _setup_bootstrap(server, new_attributes = {}) def _setup_bootstrap(server)
unless new_attributes[:key_name] unless server.key_name
# first or create fog_#{credential} keypair # first or create fog_#{credential} keypair
name = Fog.respond_to?(:credential) && Fog.credential || :default name = Fog.respond_to?(:credential) && Fog.credential || :default
unless server.key_pair = service.key_pairs.get("fog_#{name}") unless server.key_pair = service.key_pairs.get("fog_#{name}")