knife-bluebox 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -51,3 +51,6 @@ Delete block instance specified by _HOSTNAME_.
51
51
 
52
52
  ### knife bluebox server list (options)
53
53
  List all blocks currently running on the account.
54
+
55
+ ### knife bluebox location list (options)
56
+ List possible blocks locations
@@ -0,0 +1,54 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2013 Blue Box Group
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'chef/knife'
19
+
20
+ class Chef
21
+ class Knife
22
+ class BlueboxLocationList < Knife
23
+
24
+ deps do
25
+ require 'fog'
26
+ require 'highline'
27
+ require 'readline'
28
+ require 'chef/json_compat'
29
+ end
30
+
31
+ banner "knife bluebox location list"
32
+
33
+ def h
34
+ @highline ||= HighLine.new
35
+ end
36
+
37
+ def run
38
+ bluebox = Fog::Compute::Bluebox.new(
39
+ :bluebox_customer_id => Chef::Config[:knife][:bluebox_customer_id],
40
+ :bluebox_api_key => Chef::Config[:knife][:bluebox_api_key]
41
+ )
42
+
43
+ location_list = [ h.color('ID', :bold), h.color('Description', :bold) ]
44
+
45
+ bluebox.locations.each do |location|
46
+ location_list << location.id.to_s
47
+ location_list << location.description
48
+ end
49
+ puts h.list(location_list, :columns_across, 2)
50
+
51
+ end
52
+ end
53
+ end
54
+ end
@@ -51,6 +51,12 @@ class Chef
51
51
  :description => "The image of the server",
52
52
  :default => "a8f05200-7638-47d1-8282-2474ef57c4c3"
53
53
 
54
+ option :location,
55
+ :short => "-L LOCATION",
56
+ :long => "--location LOCATION",
57
+ :description => "The location UUID of the server",
58
+ :default => "37c2bd9a-3e81-46c9-b6e2-db44a25cc675"
59
+
54
60
  option :username,
55
61
  :short => "-U KEY",
56
62
  :long => "--username username",
@@ -127,10 +133,12 @@ class Chef
127
133
  puts "#{h.color("Deploying a new Blue Box Block...", :green)}\n\n"
128
134
 
129
135
  image_id = Chef::Config[:knife][:image] || config[:image]
136
+ location_id = Chef::Config[:knife][:location] || config[:location]
130
137
 
131
138
  server = bluebox.servers.new(
132
139
  :flavor_id => Chef::Config[:knife][:flavor] || config[:flavor],
133
140
  :image_id => image_id,
141
+ :location_id => location_id,
134
142
  :hostname => config[:chef_node_name],
135
143
  :username => Chef::Config[:knife][:username] || config[:username],
136
144
  :password => config[:password],
@@ -1,3 +1,3 @@
1
1
  module KnifeBlueBox
2
- VERSION = "0.8.4"
2
+ VERSION = "0.8.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-bluebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-29 00:00:00.000000000 Z
13
+ date: 2013-04-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -74,6 +74,7 @@ files:
74
74
  - lib/chef/knife/bluebox_image_delete.rb
75
75
  - lib/chef/knife/bluebox_image_list.rb
76
76
  - lib/chef/knife/bluebox_lb_list.rb
77
+ - lib/chef/knife/bluebox_location_list.rb
77
78
  - lib/chef/knife/bluebox_server_create.rb
78
79
  - lib/chef/knife/bluebox_server_delete.rb
79
80
  - lib/chef/knife/bluebox_server_list.rb