knife-ec2 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,19 +23,26 @@ class Chef
23
23
  class Knife
24
24
  class Ec2InstanceData < Knife
25
25
 
26
- banner "knife ec2 instance data [RUN LIST...] (options)"
26
+ banner "knife ec2 instance data (options)"
27
27
 
28
28
  option :edit,
29
29
  :short => "-e",
30
30
  :long => "--edit",
31
31
  :description => "Edit the instance data"
32
32
 
33
+ option :run_list,
34
+ :short => "-r RUN_LIST",
35
+ :long => "--run-list RUN_LIST",
36
+ :description => "Comma separated list of roles/recipes to apply",
37
+ :proc => lambda { |o| o.split(/[\s,]+/) },
38
+ :default => []
39
+
33
40
  def run
34
41
  data = {
35
42
  "chef_server" => Chef::Config[:chef_server_url],
36
43
  "validation_client_name" => Chef::Config[:validation_client_name],
37
44
  "validation_key" => IO.read(Chef::Config[:validation_key]),
38
- "attributes" => { "run_list" => @name_args }
45
+ "attributes" => { "run_list" => config[:run_list] }
39
46
  }
40
47
  data = edit_data(data) if config[:edit]
41
48
  output(data)
@@ -26,6 +26,14 @@ class Chef
26
26
  class Knife
27
27
  class Ec2ServerCreate < Knife
28
28
 
29
+ deps do
30
+ Chef::Knife::Bootstrap.load_deps
31
+ require 'fog'
32
+ require 'highline'
33
+ require 'net/ssh/multi'
34
+ require 'readline'
35
+ end
36
+
29
37
  banner "knife ec2 server create (options)"
30
38
 
31
39
  attr_accessor :initial_sleep_delay
@@ -170,10 +178,6 @@ class Chef
170
178
  end
171
179
 
172
180
  def run
173
- require 'fog'
174
- require 'highline'
175
- require 'net/ssh/multi'
176
- require 'readline'
177
181
 
178
182
  $stdout.sync = true
179
183
 
@@ -245,14 +249,15 @@ class Chef
245
249
 
246
250
  if !vpc_mode?
247
251
  puts "#{h.color("Public DNS Name", :cyan)}: #{server.dns_name}"
248
- puts "#{h.color("Public IP Address", :cyan)}: #{server.ip_address}"
252
+ puts "#{h.color("Public IP Address", :cyan)}: #{server.public_ip_address}"
249
253
  puts "#{h.color("Private DNS Name", :cyan)}: #{server.private_dns_name}"
250
254
  end
251
255
  puts "#{h.color("Private IP Address", :cyan)}: #{server.private_ip_address}"
252
256
 
253
257
  print "\n#{h.color("Waiting for sshd", :magenta)}"
254
258
 
255
- print(".") until tcp_test_ssh(display_name) {
259
+ ip_to_test = vpc_mode? ? server.private_ip_address : server.public_ip_address
260
+ print(".") until tcp_test_ssh(ip_to_test) {
256
261
  sleep @initial_sleep_delay ||= (vpc_mode? ? 40 : 10)
257
262
  puts("done")
258
263
  }
@@ -269,7 +274,7 @@ class Chef
269
274
  puts "#{h.color("Subnet ID", :cyan)}: #{server.subnet_id}"
270
275
  else
271
276
  puts "#{h.color("Public DNS Name", :cyan)}: #{server.dns_name}"
272
- puts "#{h.color("Public IP Address", :cyan)}: #{server.ip_address}"
277
+ puts "#{h.color("Public IP Address", :cyan)}: #{server.public_ip_address}"
273
278
  puts "#{h.color("Private DNS Name", :cyan)}: #{server.private_dns_name}"
274
279
  end
275
280
  puts "#{h.color("SSH Key", :cyan)}: #{server.key_name}"
@@ -70,7 +70,7 @@ class Chef
70
70
  msg("Security Groups", server.groups.join(", "))
71
71
  msg("SSH Key", server.key_name)
72
72
  msg("Public DNS Name", server.dns_name)
73
- msg("Public IP Address", server.ip_address)
73
+ msg("Public IP Address", server.public_ip_address)
74
74
  msg("Private DNS Name", server.private_dns_name)
75
75
  msg("Private IP Address", server.private_ip_address)
76
76
 
@@ -23,7 +23,7 @@ class Chef
23
23
  class Knife
24
24
  class Ec2ServerList < Knife
25
25
 
26
- banner "knife ec2 server list [RUN LIST...] (options)"
26
+ banner "knife ec2 server list (options)"
27
27
 
28
28
  option :aws_access_key_id,
29
29
  :short => "-A ID",
@@ -1,4 +1,4 @@
1
1
  module KnifeEC2
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
4
4
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: knife-ec2
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.1
5
+ version: 0.5.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam Jacob
@@ -10,64 +10,53 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-29 00:00:00 -07:00
13
+ date: 2011-03-31 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: chef
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.9.14
25
- type: :runtime
26
- version_requirements: *id001
27
16
  - !ruby/object:Gem::Dependency
28
17
  name: fog
29
18
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
19
+ requirement: &id001 !ruby/object:Gem::Requirement
31
20
  none: false
32
21
  requirements:
33
22
  - - ~>
34
23
  - !ruby/object:Gem::Version
35
24
  version: 0.6.0
36
25
  type: :runtime
37
- version_requirements: *id002
26
+ version_requirements: *id001
38
27
  - !ruby/object:Gem::Dependency
39
28
  name: net-ssh
40
29
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
42
31
  none: false
43
32
  requirements:
44
33
  - - ~>
45
34
  - !ruby/object:Gem::Version
46
35
  version: 2.1.3
47
36
  type: :runtime
48
- version_requirements: *id003
37
+ version_requirements: *id002
49
38
  - !ruby/object:Gem::Dependency
50
39
  name: net-ssh-multi
51
40
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
41
+ requirement: &id003 !ruby/object:Gem::Requirement
53
42
  none: false
54
43
  requirements:
55
44
  - - ~>
56
45
  - !ruby/object:Gem::Version
57
46
  version: 1.0.1
58
47
  type: :runtime
59
- version_requirements: *id004
48
+ version_requirements: *id003
60
49
  - !ruby/object:Gem::Dependency
61
50
  name: highline
62
51
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
52
+ requirement: &id004 !ruby/object:Gem::Requirement
64
53
  none: false
65
54
  requirements:
66
55
  - - ~>
67
56
  - !ruby/object:Gem::Version
68
57
  version: 1.6.1
69
58
  type: :runtime
70
- version_requirements: *id005
59
+ version_requirements: *id004
71
60
  description: EC2 Support for Chef's Knife Command
72
61
  email: adam@opscode.com
73
62
  executables: []