knife-brightbox 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,8 @@
1
+ # 0.2
2
+
3
+ * Added the ability to add server groups during bootstrap (@gkarekinian)
4
+
5
+ http://git.io/TOcHhQ
6
+
7
+ * Fixes from @gkarekinian, @kangguru
8
+ * Newer version of Fog required (1.5.0)
@@ -16,8 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.add_dependency "fog", "~> 0.8"
19
+ s.add_dependency "fog", ">= 1.5.0"
20
20
  s.add_dependency "chef", ">= 0.10"
21
21
  s.require_paths = ["lib"]
22
-
23
22
  end
@@ -27,23 +27,25 @@ class Chef
27
27
  banner "knife brightbox flavor list (options)"
28
28
 
29
29
  def run
30
- flavor_list = [
30
+ flavor_list = [
31
31
  ui.color('ID', :bold),
32
32
  ui.color('Name', :bold),
33
+ ui.color('Handle', :bold),
33
34
  ui.color('Architecture', :bold),
34
35
  ui.color('RAM', :bold),
35
36
  ui.color('Disk', :bold),
36
37
  ui.color('Cores', :bold)
37
38
  ]
38
- connection.flavors.sort_by(&:id).each do |flavor|
39
+ connection.flavors.sort_by(&:ram).each do |flavor|
39
40
  flavor_list << flavor.id.to_s
40
41
  flavor_list << flavor.name
42
+ flavor_list << flavor.handle
41
43
  flavor_list << "#{flavor.bits.to_s}-bit"
42
- flavor_list << "#{flavor.ram.to_s}"
43
- flavor_list << "#{flavor.disk.to_s} GB"
44
+ flavor_list << "#{flavor.ram.to_s} MB"
45
+ flavor_list << "#{flavor.disk / 1024} GB"
44
46
  flavor_list << flavor.cores.to_s
45
47
  end
46
- puts ui.list(flavor_list, :columns_across, 6)
48
+ puts ui.list(flavor_list, :columns_across, 7)
47
49
  end
48
50
  end
49
51
  end
@@ -29,15 +29,17 @@ class Chef
29
29
  def run
30
30
  image_list = [
31
31
  ui.color('ID', :bold),
32
- ui.color('Name', :bold)
32
+ ui.color('Name', :bold),
33
+ ui.color('Status', :bold)
33
34
  ]
34
35
 
35
36
  connection.images.sort_by(&:name).each do |image|
36
37
  image_list << image.id.to_s
37
38
  image_list << image.name
39
+ image_list << (image.public ? "public" : "private")
38
40
  end
39
41
 
40
- puts ui.list(image_list, :columns_across, 2)
42
+ puts ui.list(image_list, :columns_across, 3)
41
43
  end
42
44
  end
43
45
  end
@@ -47,6 +47,13 @@ class Chef
47
47
  :description => "The image of the server",
48
48
  :proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
49
49
 
50
+ option :server_groups,
51
+ :short => "-g grp-xxxxx,gpr-yyyyy",
52
+ :long => "--server-groups grp-xxxxx,gpr-yyyyy",
53
+ :description => "Server groups to place server in (comma delimited)",
54
+ :proc => Proc.new { |server_groups| server_groups.split(',') },
55
+ :default => []
56
+
50
57
  option :server_name,
51
58
  :short => "-S NAME",
52
59
  :long => "--server-name NAME",
@@ -142,7 +149,7 @@ class Chef
142
149
 
143
150
  puts "#{ui.color("Instance ID", :cyan)}: #{server.id}"
144
151
  puts "#{ui.color("Name", :cyan)}: #{server.name}"
145
- puts "#{ui.color("Flavor", :cyan)}: #{server.flavor.name}"
152
+ puts "#{ui.color("Flavor", :cyan)}: #{server.flavor_id}"
146
153
  puts "#{ui.color("Image", :cyan)}: #{server.image.name}"
147
154
 
148
155
  print "\n#{ui.color("Waiting server", :magenta)}"
@@ -161,21 +168,26 @@ class Chef
161
168
  puts " done\n"
162
169
 
163
170
  server = connection.servers.get(server.id)
164
- puts "#{ui.color("Public IP Address", :cyan)}: #{server.public_ip_address['public_ip'] rescue ''}"
165
- puts "#{ui.color("Private IP Address", :cyan)}: #{server.private_ip_address['ipv4_address']}"
171
+ puts "#{ui.color("Public IP Address", :cyan)}: #{server.public_ip_address}"
172
+ puts "#{ui.color("Private IP Address", :cyan)}: #{server.private_ip_address}"
173
+
174
+ config[:server_groups].each do |server_group|
175
+ connection.add_servers_server_group(server_group,
176
+ :servers => [{ :server => server.id }])
177
+ end
166
178
 
167
- print "\n#{ui.color("Bootstraping server ", :magenta)}"
179
+ print "\n#{ui.color("Bootstrapping server ", :magenta)}"
168
180
  print "\n#{ui.color("Waiting for sshd ", :magenta)}"
169
- print(".") until tcp_test_ssh(server.public_ip_address["public_ip"]) { sleep @initial_sleep_delay ||= 10; puts(" done") }
181
+ print(".") until tcp_test_ssh(server.public_ip_address) { sleep @initial_sleep_delay ||= 10; puts(" done") }
170
182
  bootstrap_for_node(server).run
171
183
 
172
184
  puts "\n"
173
185
  puts "#{ui.color("Instance ID", :cyan)}: #{server.id}"
174
186
  puts "#{ui.color("Name", :cyan)}: #{server.name}"
175
- puts "#{ui.color("Flavor", :cyan)}: #{server.flavor.name}"
187
+ puts "#{ui.color("Flavor", :cyan)}: #{server.flavor_id}"
176
188
  puts "#{ui.color("Image", :cyan)}: #{server.image.name}"
177
- puts "#{ui.color("Public IP Address", :cyan)}: #{server.public_ip_address['public_ip'] rescue ''}"
178
- puts "#{ui.color("Private IP Address", :cyan)}: #{server.private_ip_address['ipv4_address']}"
189
+ puts "#{ui.color("Public IP Address", :cyan)}: #{server.public_ip_address}"
190
+ puts "#{ui.color("Private IP Address", :cyan)}: #{server.private_ip_address}"
179
191
  puts "#{ui.color("Environment", :cyan)}: #{config[:environment] || '_default'}"
180
192
  puts "#{ui.color("Run List", :cyan)}: #{config[:run_list].join(', ')}"
181
193
  end
@@ -28,10 +28,10 @@ class Chef
28
28
 
29
29
  def run
30
30
  $stdout.sync = true
31
-
32
31
  server_list = [
33
32
  ui.color('Instance ID', :bold),
34
33
  ui.color('Private IP', :bold),
34
+ ui.color('Cloud IP', :bold),
35
35
  ui.color('Flavor', :bold),
36
36
  ui.color('Image', :bold),
37
37
  ui.color('Name', :bold),
@@ -39,8 +39,9 @@ class Chef
39
39
  ]
40
40
  connection.servers.all.each do |server|
41
41
  server_list << server.id.to_s
42
- server_list << server.private_ip_address["ipv4_address"]
43
- server_list << (server.flavor_id == nil ? "" : server.flavor_id.to_s)
42
+ server_list << server.interfaces.map{|i| i["ipv4_address"]}.join(", ")
43
+ server_list << server.cloud_ips.map{|i| i["public_ip"]}.join(", ")
44
+ server_list << server.server_type["handle"].to_s
44
45
  server_list << (server.image_id == nil ? "" : server.image_id.to_s)
45
46
  server_list << server.name
46
47
  server_list << begin
@@ -54,8 +55,8 @@ class Chef
54
55
  end
55
56
  end
56
57
  end
57
- puts ui.list(server_list, :columns_across, 6)
58
58
 
59
+ puts ui.list(server_list, :columns_across, 7)
59
60
  end
60
61
  end
61
62
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Brightbox
3
- VERSION = "0.1.6"
3
+ VERSION = "0.2.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
16
- requirement: &19169160 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0.8'
21
+ version: 1.5.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19169160
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: chef
27
- requirement: &19168580 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0.10'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *19168580
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0.10'
36
46
  description: Brightbox Support for Chef's Knife Command
37
47
  email:
38
48
  - rubiojr@frameos.org
@@ -43,6 +53,7 @@ extra_rdoc_files:
43
53
  - README.rdoc
44
54
  - LICENSE
45
55
  files:
56
+ - CHANGELOG
46
57
  - LICENSE
47
58
  - README.rdoc
48
59
  - knife-brightbox.gemspec
@@ -73,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
84
  version: '0'
74
85
  requirements: []
75
86
  rubyforge_project:
76
- rubygems_version: 1.8.10
87
+ rubygems_version: 1.8.24
77
88
  signing_key:
78
89
  specification_version: 3
79
90
  summary: Brightbox Support for Chef's Knife Command