Skip to content

Commit

Permalink
adding knife config file support for AWS regions
Browse files Browse the repository at this point in the history
  • Loading branch information
someara authored and danielsdeleo committed Nov 8, 2010
1 parent 11ef5a9 commit c46d217
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 3 additions & 2 deletions chef/lib/chef/knife/ec2_server_create.rb
Expand Up @@ -98,7 +98,8 @@ class Ec2ServerCreate < Knife
option :region,
:long => "--region REGION",
:description => "Your AWS region",
:default => "us-east-1"
:default => "us-east-1",
:proc => Proc.new { |key| Chef::Config[:knife][:region] = key }

option :distro,
:short => "-d DISTRO",
Expand Down Expand Up @@ -145,7 +146,7 @@ def run
connection = Fog::AWS::EC2.new(
:aws_access_key_id => Chef::Config[:knife][:aws_access_key_id],
:aws_secret_access_key => Chef::Config[:knife][:aws_secret_access_key],
:region => config[:region]
:region => Chef::Config[:knife][:region]
)

server = connection.servers.create(
Expand Down
9 changes: 3 additions & 6 deletions chef/lib/chef/knife/ec2_server_delete.rb
Expand Up @@ -40,7 +40,8 @@ class Ec2ServerDelete < Knife
option :region,
:long => "--region REGION",
:description => "Your AWS region",
:default => "us-east-1"
:default => "us-east-1",
:proc => Proc.new { |key| Chef::Config[:knife][:region] = key }

def h
@highline ||= HighLine.new
Expand All @@ -55,7 +56,7 @@ def run
connection = Fog::AWS::EC2.new(
:aws_access_key_id => Chef::Config[:knife][:aws_access_key_id],
:aws_secret_access_key => Chef::Config[:knife][:aws_secret_access_key],
:region => config[:region]
:region => Chef::Config[:knife][:region]
)

@name_args.each do |instance_id|
Expand Down Expand Up @@ -84,7 +85,3 @@ def run
end
end





5 changes: 3 additions & 2 deletions chef/lib/chef/knife/ec2_server_list.rb
Expand Up @@ -40,7 +40,8 @@ class Ec2ServerList < Knife
option :region,
:long => "--region REGION",
:description => "Your AWS region",
:default => "us-east-1"
:default => "us-east-1",
:proc => Proc.new { |key| Chef::Config[:knife][:region] = key }

def h
@highline ||= HighLine.new
Expand All @@ -57,7 +58,7 @@ def run
connection = Fog::AWS::EC2.new(
:aws_access_key_id => Chef::Config[:knife][:aws_access_key_id],
:aws_secret_access_key => Chef::Config[:knife][:aws_secret_access_key],
:region => config[:region]
:region => Chef::Config[:knife][:region]
)

server_list = [
Expand Down

0 comments on commit c46d217

Please sign in to comment.