knife-rackspace 0.5.4 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -6,6 +6,10 @@ This is the official Opscode Knife plugin for Rackspace. This plugin gives knife
6
6
 
7
7
  = INSTALLATION:
8
8
 
9
+ Be sure you are running the latest version Chef. Versions earlier than 0.10.0 don't support plugins:
10
+
11
+ gem install chef
12
+
9
13
  This plugin is distributed as a Ruby Gem. To install it, run:
10
14
 
11
15
  gem install knife-rackspace
@@ -52,7 +52,7 @@ class Chef
52
52
  connection = Fog::Compute.new(
53
53
  :provider => 'Rackspace',
54
54
  :rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
55
- :rackspace_username => Chef::Config[:knife][:rackspace_api_username],
55
+ :rackspace_username => Chef::Config[:knife][:rackspace_api_username] || Chef::Config[:knife][:rackspace_username],
56
56
  :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
57
57
  )
58
58
 
@@ -51,7 +51,7 @@ class Chef
51
51
  connection = Fog::Compute.new(
52
52
  :provider => 'Rackspace',
53
53
  :rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
54
- :rackspace_username => Chef::Config[:knife][:rackspace_api_username],
54
+ :rackspace_username => Chef::Config[:knife][:rackspace_api_username] || Chef::Config[:knife][:rackspace_username],
55
55
  :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
56
56
  )
57
57
 
@@ -38,8 +38,9 @@ class Chef
38
38
  option :flavor,
39
39
  :short => "-f FLAVOR",
40
40
  :long => "--flavor FLAVOR",
41
- :description => "The flavor of server",
42
- :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f.to_i }
41
+ :description => "The flavor of server; default is 2 (512 MB)",
42
+ :proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f.to_i },
43
+ :default => 2
43
44
 
44
45
  option :image,
45
46
  :short => "-I IMAGE",
@@ -60,7 +61,7 @@ class Chef
60
61
  option :ssh_user,
61
62
  :short => "-x USERNAME",
62
63
  :long => "--ssh-user USERNAME",
63
- :description => "The ssh username",
64
+ :description => "The ssh username; default is 'root'",
64
65
  :default => "root"
65
66
 
66
67
  option :ssh_password,
@@ -82,7 +83,7 @@ class Chef
82
83
 
83
84
  option :rackspace_api_auth_url,
84
85
  :long => "--rackspace-api-auth-url URL",
85
- :description => "Your rackspace API auth url",
86
+ :description => "Your rackspace API auth url; default is 'auth.api.rackspacecloud.com'",
86
87
  :proc => Proc.new { |url| Chef::Config[:knife][:rackspace_api_auth_url] = url },
87
88
  :default => "auth.api.rackspacecloud.com"
88
89
 
@@ -98,7 +99,7 @@ class Chef
98
99
  option :distro,
99
100
  :short => "-d DISTRO",
100
101
  :long => "--distro DISTRO",
101
- :description => "Bootstrap a distro using a template",
102
+ :description => "Bootstrap a distro using a template; default is 'ubuntu10.04-gems'",
102
103
  :proc => Proc.new { |d| Chef::Config[:knife][:distro] = d },
103
104
  :default => "ubuntu10.04-gems"
104
105
 
@@ -132,9 +133,14 @@ class Chef
132
133
  end
133
134
  rescue Errno::ETIMEDOUT
134
135
  false
136
+ rescue Errno::EPERM
137
+ false
135
138
  rescue Errno::ECONNREFUSED
136
139
  sleep 2
137
140
  false
141
+ rescue Errno::EHOSTUNREACH
142
+ sleep 2
143
+ false
138
144
  ensure
139
145
  tcp_socket && tcp_socket.close
140
146
  end
@@ -145,14 +151,19 @@ class Chef
145
151
  connection = Fog::Compute.new(
146
152
  :provider => 'Rackspace',
147
153
  :rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
148
- :rackspace_username => Chef::Config[:knife][:rackspace_api_username],
149
- :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
154
+ :rackspace_username => Chef::Config[:knife][:rackspace_api_username] || Chef::Config[:knife][:rackspace_username],
155
+ :rackspace_auth_url => locate_config_value(:rackspace_api_auth_url)
150
156
  )
151
157
 
158
+ unless Chef::Config[:knife][:image]
159
+ ui.error("You have not provided a valid image value. Please note the short option for this value recently changed from '-i' to '-I'.")
160
+ exit 1
161
+ end
162
+
152
163
  server = connection.servers.create(
153
164
  :name => config[:server_name],
154
165
  :image_id => Chef::Config[:knife][:image],
155
- :flavor_id => Chef::Config[:knife][:flavor]
166
+ :flavor_id => locate_config_value(:flavor)
156
167
  )
157
168
 
158
169
  puts "#{ui.color("Instance ID", :cyan)}: #{server.id}"
@@ -29,7 +29,7 @@ class Chef
29
29
  require 'resolv'
30
30
  end
31
31
 
32
- banner "knife rackspace server delete SERVER (options)"
32
+ banner "knife rackspace server delete SERVER_ID (options)"
33
33
 
34
34
  option :rackspace_api_key,
35
35
  :short => "-K KEY",
@@ -58,7 +58,7 @@ class Chef
58
58
  connection = Fog::Compute.new(
59
59
  :provider => 'Rackspace',
60
60
  :rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
61
- :rackspace_username => Chef::Config[:knife][:rackspace_api_username],
61
+ :rackspace_username => Chef::Config[:knife][:rackspace_api_username] || Chef::Config[:knife][:rackspace_username],
62
62
  :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
63
63
  )
64
64
 
@@ -43,7 +43,7 @@ class Chef
43
43
 
44
44
  option :rackspace_api_auth_url,
45
45
  :long => "--rackspace-api-auth-url URL",
46
- :description => "Your rackspace API auth url",
46
+ :description => "Your rackspace API auth url; default is 'auth.api.rackspacecloud.com'",
47
47
  :default => "auth.api.rackspacecloud.com",
48
48
  :proc => Proc.new { |url| Chef::Config[:knife][:rackspace_api_auth_url] = url }
49
49
 
@@ -53,27 +53,27 @@ class Chef
53
53
  connection = Fog::Compute.new(
54
54
  :provider => 'Rackspace',
55
55
  :rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
56
- :rackspace_username => Chef::Config[:knife][:rackspace_api_username],
56
+ :rackspace_username => Chef::Config[:knife][:rackspace_api_username] || Chef::Config[:knife][:rackspace_username],
57
57
  :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
58
58
  )
59
59
 
60
60
  server_list = [
61
- ui.color('ID', :bold),
62
- ui.color('Name', :bold),
61
+ ui.color('Instance ID', :bold),
63
62
  ui.color('Public IP', :bold),
64
63
  ui.color('Private IP', :bold),
65
64
  ui.color('Flavor', :bold),
66
65
  ui.color('Image', :bold),
66
+ ui.color('Name', :bold),
67
67
  ui.color('State', :bold)
68
68
  ]
69
69
  connection.servers.all.each do |server|
70
70
  server_list << server.id.to_s
71
+ server_list << (server.public_ip_address == nil ? "" : server.public_ip_address)
72
+ server_list << (server.addresses["private"].first == nil ? "" : server.addresses["private"].first)
73
+ server_list << (server.flavor_id == nil ? "" : server.flavor_id.to_s)
74
+ server_list << (server.image_id == nil ? "" : server.image_id.to_s)
71
75
  server_list << server.name
72
- server_list << server.addresses["public"][0]
73
- server_list << server.addresses["private"][0]
74
- server_list << server.flavor.name.split(/\s/).first
75
- server_list << server.image.name
76
- server_list << server.status.downcase
76
+ server_list << (server.state == nil ? "" : server.state.downcase)
77
77
  end
78
78
  puts ui.list(server_list, :columns_across, 7)
79
79
 
@@ -1,3 +1,3 @@
1
1
  module KnifeRackspace
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.6"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: knife-rackspace
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.4
5
+ version: 0.5.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam Jacob
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-02 00:00:00 -04:00
13
+ date: 2011-06-23 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 0.7.2
24
+ version: 0.8.2
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency