Module: Chef::Knife::EucaBase
- Included in:
- EucaFlavorList, EucaImageList, EucaServerCreate, EucaServerDelete, EucaServerList
- Defined in:
- lib/chef/knife/euca_base.rb
Class Method Summary collapse
-
.included(includer) ⇒ Object
:nodoc: Would prefer to do this in a rational way, but can’t be done b/c of Mixlib::CLI’s design :(.
Instance Method Summary collapse
Class Method Details
.included(includer) ⇒ Object
:nodoc: Would prefer to do this in a rational way, but can’t be done b/c of Mixlib::CLI’s design :(
29 30 31 32 33 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 61 |
# File 'lib/chef/knife/euca_base.rb', line 29 def self.included(includer) includer.class_eval do deps do require 'fog' require 'readline' require 'chef/json_compat' end option :euca_access_key_id, :short => "-A ID", :long => "--euca-access-key-id KEY", :description => "Your Eucalyptus Access Key ID", :proc => Proc.new { |key| Chef::Config[:knife][:euca_access_key_id] = key } option :euca_secret_access_key, :short => "-K SECRET", :long => "--euca-secret-access-key SECRET", :description => "Your Eucalyptus API Secret Access Key", :proc => Proc.new { |key| Chef::Config[:knife][:euca_secret_access_key] = key } option :euca_api_endpoint, :long => "--euca-api-endpoint ENDPOINT", :description => "Your Eucalyptus API endpoint", :default => "http://ecc.eucalyptus.com:8773/services/Eucalyptus", :proc => Proc.new { |endpoint| Chef::Config[:knife][:euca_api_endpoint] = endpoint } option :region, :long => "--region REGION", :description => "Your Eucalyptus region", :proc => Proc.new { |region| Chef::Config[:knife][:region] = region } end end |
Instance Method Details
#connection ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/chef/knife/euca_base.rb', line 63 def connection @connection ||= begin Fog::Compute.new( :provider => 'AWS', :aws_access_key_id => Chef::Config[:knife][:euca_access_key_id], :aws_secret_access_key => Chef::Config[:knife][:euca_secret_access_key], :endpoint => Chef::Config[:knife][:euca_api_endpoint] || config[:euca_api_endpoint], :region => Chef::Config[:knife][:region] || config[:region] ) end end |
#locate_config_value(key) ⇒ Object
83 84 85 86 |
# File 'lib/chef/knife/euca_base.rb', line 83 def locate_config_value(key) key = key.to_sym Chef::Config[:knife][key] || config[key] end |
#public_ip(public_dns) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/chef/knife/euca_base.rb', line 75 def public_ip(public_dns) @public_ip ||= begin require 'resolv' Resolv.getaddress(public_dns) rescue end end |