Class: Chef::Resource::GoogleKeyPair
- Inherits:
-
LWRPBase
- Object
- LWRPBase
- Chef::Resource::GoogleKeyPair
- Defined in:
- lib/chef/resource/google_key_pair.rb
Instance Method Summary collapse
-
#after_created ⇒ Object
TODO: add a ‘user` attribute which sets the user to login with the key GCE uses the key user to create a user on the instance, which may duplicate some logic the user is trying to do with their chef recipes.
-
#driver ⇒ Object
TODO introduce base class and add this as attribute, like AWS does Ideally, we won’t be creating lots of copies of the same driver object, but it is okay if we do - they aren’t singletons.
Instance Method Details
#after_created ⇒ Object
TODO: add a ‘user` attribute which sets the user to login with the key GCE uses the key user to create a user on the instance, which may duplicate some logic the user is trying to do with their chef recipes
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/chef/resource/google_key_pair.rb', line 28 def after_created # We default these here so load_current_resource can diff if private_key_path.nil? private_key_path ::File.join(driver.config[:private_key_write_path], "google_default") elsif Pathname.new(private_key_path).relative? private_key_path ::File.join(driver.config[:private_key_write_path], private_key_path) end # TODO you don't actually need to write the private key to disc if it isn't provided # it can be read from the private key, but this code update needs testing if public_key_path.nil? public_key_path ::File.join(driver.config[:private_key_write_path], "google_default.pub") elsif Pathname.new(public_key_path).relative? public_key_path ::File.join(driver.config[:private_key_write_path], public_key_path) end end |
#driver ⇒ Object
TODO introduce base class and add this as attribute, like AWS does Ideally, we won’t be creating lots of copies of the same driver object, but it is okay if we do - they aren’t singletons
47 48 49 |
# File 'lib/chef/resource/google_key_pair.rb', line 47 def driver run_context.chef_provisioning.driver_for(run_context.chef_provisioning.current_driver) end |