knife-eucalyptus 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,39 +21,45 @@ require 'chef/knife'
21
21
 
22
22
  class Chef
23
23
  class Knife
24
- class EucaBase < Knife
24
+ module EucaBase
25
25
 
26
- deps do
27
- require 'fog'
28
- require 'net/ssh/multi'
29
- require 'readline'
30
- require 'chef/json_compat'
31
- end
26
+ # :nodoc:
27
+ # Would prefer to do this in a rational way, but can't be done b/c of
28
+ # Mixlib::CLI's design :(
29
+ def self.included(includer)
30
+ includer.class_eval do
32
31
 
33
- banner ""
32
+ deps do
33
+ require 'fog'
34
+ require 'net/ssh/multi'
35
+ require 'readline'
36
+ require 'chef/json_compat'
37
+ end
34
38
 
35
- option :euca_access_key_id,
36
- :short => "-A ID",
37
- :long => "--euca-access-key-id KEY",
38
- :description => "Your Eucalyptus Access Key ID",
39
- :proc => Proc.new { |key| Chef::Config[:knife][:euca_access_key_id] = key }
39
+ option :euca_access_key_id,
40
+ :short => "-A ID",
41
+ :long => "--euca-access-key-id KEY",
42
+ :description => "Your Eucalyptus Access Key ID",
43
+ :proc => Proc.new { |key| Chef::Config[:knife][:euca_access_key_id] = key }
40
44
 
41
- option :euca_secret_access_key,
42
- :short => "-K SECRET",
43
- :long => "--euca-secret-access-key SECRET",
44
- :description => "Your Eucalyptus API Secret Access Key",
45
- :proc => Proc.new { |key| Chef::Config[:knife][:euca_secret_access_key] = key }
45
+ option :euca_secret_access_key,
46
+ :short => "-K SECRET",
47
+ :long => "--euca-secret-access-key SECRET",
48
+ :description => "Your Eucalyptus API Secret Access Key",
49
+ :proc => Proc.new { |key| Chef::Config[:knife][:euca_secret_access_key] = key }
46
50
 
47
- option :euca_api_endpoint,
48
- :long => "--euca-api-endpoint ENDPOINT",
49
- :description => "Your Eucalyptus API endpoint",
50
- :default => "http://ecc.eucalyptus.com:8773/services/Eucalyptus",
51
- :proc => Proc.new { |endpoint| Chef::Config[:knife][:euca_api_endpoint] = endpoint }
51
+ option :euca_api_endpoint,
52
+ :long => "--euca-api-endpoint ENDPOINT",
53
+ :description => "Your Eucalyptus API endpoint",
54
+ :default => "http://ecc.eucalyptus.com:8773/services/Eucalyptus",
55
+ :proc => Proc.new { |endpoint| Chef::Config[:knife][:euca_api_endpoint] = endpoint }
52
56
 
53
- option :region,
54
- :long => "--region REGION",
55
- :description => "Your Eucalyptus region",
56
- :proc => Proc.new { |region| Chef::Config[:knife][:region] = region }
57
+ option :region,
58
+ :long => "--region REGION",
59
+ :description => "Your Eucalyptus region",
60
+ :proc => Proc.new { |region| Chef::Config[:knife][:region] = region }
61
+ end
62
+ end
57
63
 
58
64
  def connection
59
65
  @connection ||= begin
@@ -20,7 +20,9 @@ require 'chef/knife/euca_base'
20
20
 
21
21
  class Chef
22
22
  class Knife
23
- class EucaFlavorList < EucaBase
23
+ class EucaFlavorList < Knife
24
+
25
+ include Knife::EucaBase
24
26
 
25
27
  banner "knife euca flavor list (options)"
26
28
 
@@ -20,7 +20,9 @@ require 'chef/knife/euca_base'
20
20
 
21
21
  class Chef
22
22
  class Knife
23
- class EucaImageList < EucaBase
23
+ class EucaImageList < Knife
24
+
25
+ include Knife::EucaBase
24
26
 
25
27
  banner "knife euca image list (options)"
26
28
 
@@ -20,9 +20,15 @@ require 'chef/knife/euca_base'
20
20
 
21
21
  class Chef
22
22
  class Knife
23
- class EucaServerCreate < EucaBase
23
+ class EucaServerCreate < Knife
24
+
25
+ include Knife::EucaBase
24
26
 
25
27
  deps do
28
+ require 'fog'
29
+ require 'net/ssh/multi'
30
+ require 'readline'
31
+ require 'chef/json_compat'
26
32
  require 'chef/knife/bootstrap'
27
33
  Chef::Knife::Bootstrap.load_deps
28
34
  end
@@ -177,7 +183,7 @@ class Chef
177
183
  print "\n#{ui.color("Waiting for sshd", :magenta)}"
178
184
 
179
185
  print(".") until tcp_test_ssh(display_name) {
180
- sleep @initial_sleep_delay ||= 10
186
+ sleep @initial_sleep_delay ||= 20
181
187
  puts("done")
182
188
  }
183
189
 
@@ -20,7 +20,9 @@ require 'chef/knife/euca_base'
20
20
 
21
21
  class Chef
22
22
  class Knife
23
- class EucaServerDelete < EucaBase
23
+ class EucaServerDelete < Knife
24
+
25
+ include Knife::EucaBase
24
26
 
25
27
  banner "knife euca server delete SERVER_ID [SERVER_ID] (options)"
26
28
 
@@ -20,7 +20,9 @@ require 'chef/knife/euca_base'
20
20
 
21
21
  class Chef
22
22
  class Knife
23
- class EucaServerList < EucaBase
23
+ class EucaServerList < Knife
24
+
25
+ include Knife::EucaBase
24
26
 
25
27
  banner "knife euca server list (options)"
26
28
 
@@ -41,7 +43,16 @@ class Chef
41
43
  server_list << (server.flavor_id || "")
42
44
  server_list << (server.image_id || "")
43
45
  server_list << server.groups.join(", ")
44
- server_list << server.state
46
+ server_list << begin
47
+ case server.state
48
+ when 'shutting-down'
49
+ ui.color(server.state, :red)
50
+ when 'pending'
51
+ ui.color(server.state, :yellow)
52
+ else
53
+ ui.color(server.state, :green)
54
+ end
55
+ end
45
56
  end
46
57
  puts ui.list(server_list, :columns_across, 6)
47
58
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Eucalyptus
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.2"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: knife-eucalyptus
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Seth Chisamore
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-15 00:00:00 -07:00
13
+ date: 2011-07-18 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency