knife-cloudstack 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGES.rdoc +14 -0
- data/README.rdoc +2 -0
- data/lib/chef/knife/cs_baselist.rb +5 -5
- data/lib/chef/knife/cs_firewallrule_create.rb +2 -4
- data/lib/chef/knife/cs_forwardrule_create.rb +2 -4
- data/lib/chef/knife/cs_server_create.rb +14 -3
- data/lib/chef/knife/cs_server_delete.rb +3 -3
- data/lib/chef/knife/cs_stack_create.rb +19 -31
- data/lib/chef/knife/cs_volume_delete.rb +97 -0
- data/lib/knife-cloudstack/connection.rb +48 -9
- metadata +44 -49
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDExMjBmZjJkYTYxMzBlN2RiZmM0ZTFmMTg1YTgyMWEwN2UwNDljYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDZkMDBkOTQyNjY5OTJlZGU1NTBiNjUxNmY5YjZkMmU1Mzg0NzdmMg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTIyMjZhNmE2ZjQwNjI2OTcwN2U0M2JkYzA3MDJmNjIwZDdjNzk4ZmJiMmVi
|
10
|
+
Mjk1ODM0ZDU5ZDZlN2U3ZDAzMjdlOWExMDFlYjBjOTA0NDVjNDE0YjU5ZTBk
|
11
|
+
ZTVkODZlZmZlYjM0ZWJhMDM3OTQwYmYzYTFiZGViNzRjYTNmYzE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NmE4YzFiOWJiYTUzNDk0MjQ0OTkxNTExNDYyNGEyNjJjYTFlMTdhNjM1NDdl
|
14
|
+
NDFhYmE1ZjJmNjdjZjliYzUyODdkZjUwYThhMTQ3MTU3MGQ0ZDNhZWUxMzdh
|
15
|
+
MDk2OGI2NjMzYTU3YWYwMGJlZWJlZjU0YzZjNTQ5YjMwNjNhZGE=
|
data/CHANGES.rdoc
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
= Changes
|
2
2
|
|
3
|
+
== 2014-12-29 (0.0.18)
|
4
|
+
* Chef 12 has been released and installation of the plugin fails on certain components while it tries to install the latest chef-gem.
|
5
|
+
We are pinning this version on chef 11.0 and we will make the new version 0.1.0 chef 12 compatible.
|
6
|
+
If you have a urgent need for this, please drop us a line. (Sander Botman 29 Dec 2014)
|
7
|
+
* Added support for --bootstrap-wget-options for <tt>cs server create</tt> (Deepak Sihag 25 Sep 2014)
|
8
|
+
* Added subcommand: <tt>cs volume delete</tt> (Muga Nishizawa 7 May 2014)
|
9
|
+
* Bugfix: within the README (Warren Bain 15 Apr 2014)
|
10
|
+
* Added support for --size for <tt>cs server create</tt> (Muga Nishizawa 14 Apr 2014)
|
11
|
+
* Bugfix: list_object method calls by invalid typed parameters (Muga Nishizawa 11 Apr 2014)
|
12
|
+
* Bugfix: flexibility around ssh port configuration (Warren Bain 9 Apr 2014)
|
13
|
+
* Bugfix: cosmetic fix to options indenting (Warren Bain 9 Apr 2014)
|
14
|
+
* Bugfix: remove fqdn from node name when deleting server (Warren Bain 9 Apr 2014)
|
15
|
+
* Bugfix: fix whitespace (Warren Bain 9 Apr 2014)
|
16
|
+
|
3
17
|
== 2014-03-04 (0.0.17)
|
4
18
|
* Added support for --isdynamicallyscalable for <tt>cs template register</tt> (Sander Botman, 3 Apr 2014)
|
5
19
|
* Added support for --anti-affinity-groups for <tt>cs server create</tt> (John E. Vincent, 2 Apr 2014)
|
data/README.rdoc
CHANGED
@@ -311,6 +311,8 @@ Displays all the volumes that are currently available within the cloudstack envi
|
|
311
311
|
Creates a "stack" of servers based on a JSON definition file. Simple orchestration can be performed by
|
312
312
|
specifying one or more actions to be executed after a server (or group of servers) is created.
|
313
313
|
|
314
|
+
<tt>--skip-existing</tt> Skip erroring on any servers already created in the stack (default is false)
|
315
|
+
|
314
316
|
==== Example Stack Definition File:
|
315
317
|
|
316
318
|
{
|
@@ -49,9 +49,9 @@ class Chef
|
|
49
49
|
|
50
50
|
def output_format(json)
|
51
51
|
if locate_config_value(:format) =~ /^j/i
|
52
|
-
json_hash = {};
|
52
|
+
json_hash = {};
|
53
53
|
json.each { |k| json_hash.merge!( k['id'] => k) }
|
54
|
-
puts JSON.pretty_generate(json_hash)
|
54
|
+
puts JSON.pretty_generate(json_hash)
|
55
55
|
exit 0
|
56
56
|
end
|
57
57
|
end
|
@@ -85,16 +85,16 @@ class Chef
|
|
85
85
|
object_list = []
|
86
86
|
if locate_config_value(:fields)
|
87
87
|
locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
|
88
|
-
else
|
88
|
+
else
|
89
89
|
columns.each do |column|
|
90
|
-
n = (column.split(':').first).strip
|
90
|
+
n = (column.split(':').first).strip
|
91
91
|
object_list << (ui.color("#{n}", :bold) || 'N/A')
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
n_columns = object_list.count
|
96
96
|
object_list = [] if locate_config_value(:noheader)
|
97
|
-
|
97
|
+
|
98
98
|
object.each do |r|
|
99
99
|
if locate_config_value(:fields)
|
100
100
|
locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
|
@@ -47,10 +47,8 @@ module KnifeCloudstack
|
|
47
47
|
locate_config_value(:openfirewall) ? params['openfirewall'] = 'true' : params['openfirewall'] = 'false'
|
48
48
|
|
49
49
|
# Lookup all server objects.
|
50
|
-
|
51
|
-
|
52
|
-
"virtualmachine"
|
53
|
-
)
|
50
|
+
params_for_list_object = { 'command' => 'listVirtualMachines' }
|
51
|
+
connection_result = connection.list_object(params_for_list_object, "virtualmachine")
|
54
52
|
|
55
53
|
# Lookup the hostname in the connection result
|
56
54
|
server = {}
|
@@ -52,10 +52,8 @@ module KnifeCloudstack
|
|
52
52
|
locate_config_value(:openfirewall) ? params['openfirewall'] = 'true' : params['openfirewall'] = 'false'
|
53
53
|
|
54
54
|
# Lookup all server objects.
|
55
|
-
|
56
|
-
|
57
|
-
"virtualmachine"
|
58
|
-
)
|
55
|
+
params_for_list_object = { 'command' => 'listVirtualMachines' }
|
56
|
+
connection_result = connection.list_object(params_for_list_object, "virtualmachine")
|
59
57
|
|
60
58
|
# Lookup the hostname in the connection result
|
61
59
|
server = {}
|
@@ -88,6 +88,10 @@ module KnifeCloudstack
|
|
88
88
|
:description => "The CloudStack disk offering name",
|
89
89
|
:proc => Proc.new { |d| Chef::Config[:knife][:cloudstack_disk] = d }
|
90
90
|
|
91
|
+
option :size,
|
92
|
+
:long => "--size SIZE",
|
93
|
+
:description => "The arbitrary size (GB) for the DATADISK volume"
|
94
|
+
|
91
95
|
option :cloudstack_hypervisor,
|
92
96
|
:long => '--cloudstack-hypervisor HYPERVISOR',
|
93
97
|
:description => "The CloudStack hypervisor type for the server"
|
@@ -206,9 +210,9 @@ module KnifeCloudstack
|
|
206
210
|
:default => []
|
207
211
|
|
208
212
|
option :aag,
|
209
|
-
|
210
|
-
|
211
|
-
|
213
|
+
:long => "--anti-affinity-groups GROUP_NAME",
|
214
|
+
:description => "Comma separated list of anti-affinity group names",
|
215
|
+
:default => false
|
212
216
|
|
213
217
|
option :fw_rules,
|
214
218
|
:short => "-f PORT_RULES",
|
@@ -231,6 +235,11 @@ module KnifeCloudstack
|
|
231
235
|
:description => "Set the same server display name as Chef node name.",
|
232
236
|
:boolean => true,
|
233
237
|
:default => false
|
238
|
+
|
239
|
+
option :bootstrap_wget_options,
|
240
|
+
:long => "--bootstrap-wget-options OPTIONS",
|
241
|
+
:description => "Add options to wget when installing chef-client",
|
242
|
+
:proc => Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
|
234
243
|
|
235
244
|
|
236
245
|
def run
|
@@ -276,6 +285,7 @@ module KnifeCloudstack
|
|
276
285
|
params['affinitygroupnames'] = locate_config_value :aag if locate_config_value :aag
|
277
286
|
params['displayname'] = if locate_config_value :set_display_name and locate_config_value :chef_node_name then locate_config_value :chef_node_name else hostname end
|
278
287
|
params['ipaddress'] = locate_config_value(:ik_private_ip) if locate_config_value(:ik_private_ip)
|
288
|
+
params['size'] = locate_config_value(:size) if locate_config_value(:size)
|
279
289
|
|
280
290
|
server = connection.create_server(
|
281
291
|
hostname,
|
@@ -605,6 +615,7 @@ module KnifeCloudstack
|
|
605
615
|
bootstrap.config[:template_file] = locate_config_value(:template_file)
|
606
616
|
bootstrap.config[:first_boot_attributes] = locate_config_value(:first_boot_attributes)
|
607
617
|
bootstrap.config[:environment] = locate_config_value(:environment)
|
618
|
+
bootstrap.config[:bootstrap_wget_options] = locate_config_value(:bootstrap_wget_options)
|
608
619
|
bootstrap
|
609
620
|
end
|
610
621
|
|
@@ -63,8 +63,8 @@ module KnifeCloudstack
|
|
63
63
|
ui.msg("Deleted server #{hostname}")
|
64
64
|
|
65
65
|
# delete chef client and node
|
66
|
-
node_name = connection.get_server_fqdn server
|
67
|
-
delete_chef = confirm_action("Do you want to delete the chef node and client '#{node_name}")
|
66
|
+
node_name = hostname # connection.get_server_fqdn server ## server create doesn't add fqdn!
|
67
|
+
delete_chef = confirm_action("Do you want to delete the chef node and client '#{node_name}'")
|
68
68
|
if delete_chef
|
69
69
|
delete_node node_name
|
70
70
|
delete_client node_name
|
@@ -76,7 +76,7 @@ module KnifeCloudstack
|
|
76
76
|
|
77
77
|
def show_object_details(s, connection, rules)
|
78
78
|
return if locate_config_value(:yes)
|
79
|
-
|
79
|
+
|
80
80
|
object_fields = []
|
81
81
|
object_fields << ui.color("Name:", :cyan)
|
82
82
|
object_fields << s['name'].to_s
|
@@ -58,6 +58,11 @@ module KnifeCloudstack
|
|
58
58
|
:long => "--identity-file IDENTITY_FILE",
|
59
59
|
:description => "The SSH identity file used for authentication"
|
60
60
|
|
61
|
+
option :skip_existing,
|
62
|
+
:long => "--skip-existing",
|
63
|
+
:default => false,
|
64
|
+
:description => "Skip creating existing server(s)"
|
65
|
+
|
61
66
|
def run
|
62
67
|
validate_base_options
|
63
68
|
if @name_args.first.nil?
|
@@ -82,9 +87,13 @@ module KnifeCloudstack
|
|
82
87
|
# create server(s)
|
83
88
|
names = server[:name].split(/[\s,]+/)
|
84
89
|
names.each do |n|
|
85
|
-
|
86
|
-
|
87
|
-
|
90
|
+
if (config[:skip_existing] && connection.get_server(n))
|
91
|
+
ui.msg(ui.color("\nServer #{n} already exists; skipping create...", :yellow))
|
92
|
+
else
|
93
|
+
s = Mash.new(server)
|
94
|
+
s[:name] = n
|
95
|
+
create_server(s)
|
96
|
+
end
|
88
97
|
end
|
89
98
|
|
90
99
|
end
|
@@ -109,7 +118,7 @@ module KnifeCloudstack
|
|
109
118
|
cmd.config[:cloudstack_project] = config[:cloudstack_project]
|
110
119
|
cmd.config[:ssh_user] = config[:ssh_user]
|
111
120
|
cmd.config[:ssh_password] = config[:ssh_password]
|
112
|
-
cmd.config[:ssh_port] =
|
121
|
+
cmd.config[:ssh_port] = server[:ssh_port] || locate_config_value(:ssh_port) || "22"
|
113
122
|
cmd.config[:identity_file] = config[:identity_file]
|
114
123
|
cmd.config[:keypair] = server[:keypair]
|
115
124
|
cmd.config[:cloudstack_template] = server[:template] if server[:template]
|
@@ -117,11 +126,11 @@ module KnifeCloudstack
|
|
117
126
|
cmd.config[:cloudstack_zone] = server[:zone] if server[:zone]
|
118
127
|
server.has_key?(:public_ip) ? cmd.config[:public_ip] = server[:public_ip] : cmd.config[:no_public_ip] = true
|
119
128
|
cmd.config[:ik_private_ip] = server[:private_ip] if server[:private_ip]
|
120
|
-
cmd.config[:bootstrap] = server[:bootstrap] if server.has_key?(:bootstrap)
|
121
|
-
cmd.config[:bootstrap_protocol] = server[:bootstrap_protocol] || "ssh"
|
122
|
-
cmd.config[:distro] = server[:distro] || "chef-full"
|
123
|
-
cmd.config[:template_file] = server[:template_file] if server.has_key?(:template_file)
|
124
|
-
cmd.config[:no_host_key_verify] = server[:no_host_key_verify] if server.has_key?(:no_host_key_verify)
|
129
|
+
cmd.config[:bootstrap] = server[:bootstrap] if server.has_key?(:bootstrap)
|
130
|
+
cmd.config[:bootstrap_protocol] = server[:bootstrap_protocol] || "ssh"
|
131
|
+
cmd.config[:distro] = server[:distro] || "chef-full"
|
132
|
+
cmd.config[:template_file] = server[:template_file] if server.has_key?(:template_file)
|
133
|
+
cmd.config[:no_host_key_verify] = server[:no_host_key_verify] if server.has_key?(:no_host_key_verify)
|
125
134
|
cmd.config[:cloudstack_networks] = server[:networks].split(/[\s,]+/) if server[:networks]
|
126
135
|
cmd.config[:run_list] = server[:run_list].split(/[\s,]+/) if server[:run_list]
|
127
136
|
cmd.config[:port_rules] = server[:port_rules].split(/[\s,]+/) if server[:port_rules]
|
@@ -134,6 +143,7 @@ module KnifeCloudstack
|
|
134
143
|
end
|
135
144
|
|
136
145
|
def run_actions(actions)
|
146
|
+
return if actions.nil? || actions.empty?
|
137
147
|
puts "\n"
|
138
148
|
ui.msg("Processing actions...")
|
139
149
|
sleep 1 # pause for e.g. chef solr indexing
|
@@ -183,7 +193,6 @@ module KnifeCloudstack
|
|
183
193
|
end
|
184
194
|
|
185
195
|
def knife_ssh(host_list, command)
|
186
|
-
|
187
196
|
ssh = Chef::Knife::Ssh.new
|
188
197
|
ssh.name_args = [host_list, command]
|
189
198
|
ssh.config[:ssh_user] = config[:ssh_user]
|
@@ -203,7 +212,6 @@ module KnifeCloudstack
|
|
203
212
|
end
|
204
213
|
|
205
214
|
def knife_ssh_action(query, command)
|
206
|
-
|
207
215
|
public_ips = find_public_ips(query)
|
208
216
|
return if public_ips.nil? || public_ips.empty?
|
209
217
|
host_list = public_ips.join(' ')
|
@@ -218,7 +226,6 @@ module KnifeCloudstack
|
|
218
226
|
ssh.run
|
219
227
|
end
|
220
228
|
end
|
221
|
-
|
222
229
|
end
|
223
230
|
|
224
231
|
def http_request(url)
|
@@ -229,7 +236,6 @@ module KnifeCloudstack
|
|
229
236
|
url = url.sub(/\$\{#{server_name}\}/, ip)
|
230
237
|
end
|
231
238
|
|
232
|
-
|
233
239
|
puts "HTTP Request: #{url}"
|
234
240
|
puts `curl -s -m 5 #{url}`
|
235
241
|
end
|
@@ -272,24 +278,6 @@ module KnifeCloudstack
|
|
272
278
|
current_stack[:environment]
|
273
279
|
end
|
274
280
|
|
275
|
-
def destroy_all(domain, excludes=[])
|
276
|
-
servers = connection.list_servers || []
|
277
|
-
servers.each do |s|
|
278
|
-
excluded = false
|
279
|
-
excludes.each { |val|
|
280
|
-
if s['name'] =~ /#{val}/ then
|
281
|
-
excluded = true
|
282
|
-
next
|
283
|
-
end
|
284
|
-
}
|
285
|
-
next if excluded
|
286
|
-
nodename = "#{s['name']}.#{domain}"
|
287
|
-
system "knife cs server delete #{s['name']} -y"
|
288
|
-
system "knife client delete #{nodename} -y"
|
289
|
-
system "knife node delete #{nodename} -y"
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
281
|
def print_local_hosts
|
294
282
|
hosts = []
|
295
283
|
current_stack[:servers].each do |server|
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Muga Nishizawa (<muga.nishizawa@gmail.com>)
|
3
|
+
# Copyright:: Copyright (c) 2014 Muga Nishizawa.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/knife/cs_base'
|
20
|
+
|
21
|
+
module KnifeCloudstack
|
22
|
+
class CsVolumeDelete < Chef::Knife
|
23
|
+
|
24
|
+
include Chef::Knife::KnifeCloudstackBase
|
25
|
+
|
26
|
+
deps do
|
27
|
+
require 'knife-cloudstack/connection'
|
28
|
+
require 'chef/api_client'
|
29
|
+
require 'chef/knife'
|
30
|
+
Chef::Knife.load_deps
|
31
|
+
end
|
32
|
+
|
33
|
+
banner "knife cs volume delete VOLUME_NAME [VOLUME_NAME ...] (options)"
|
34
|
+
|
35
|
+
def run
|
36
|
+
validate_base_options
|
37
|
+
|
38
|
+
@name_args.each do |volume_name|
|
39
|
+
volume = connection.get_volume(volume_name)
|
40
|
+
|
41
|
+
if !volume then
|
42
|
+
ui.error("Volume '#{volume_name}' not found")
|
43
|
+
next
|
44
|
+
end
|
45
|
+
|
46
|
+
if vmn = volume['vmname']
|
47
|
+
ui.error("Volume '#{volume_name}' attached to VM '#{vmn}'")
|
48
|
+
ui.error("You should detach it from VM to delete the volume.")
|
49
|
+
next
|
50
|
+
end
|
51
|
+
|
52
|
+
show_object_details(volume)
|
53
|
+
|
54
|
+
result = confirm_action("Do you really want to delete this volume")
|
55
|
+
if result
|
56
|
+
print "#{ui.color("Waiting for deletion", :magenta)}"
|
57
|
+
connection.delete_volume(volume_name)
|
58
|
+
puts "\n"
|
59
|
+
ui.msg("Deleted volume #{volume_name}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def show_object_details(v)
|
65
|
+
return if locate_config_value(:yes)
|
66
|
+
|
67
|
+
object_fields = []
|
68
|
+
object_fields << ui.color("Name:", :cyan)
|
69
|
+
object_fields << v['name'].to_s
|
70
|
+
object_fields << ui.color("Account:", :cyan)
|
71
|
+
object_fields << v['account']
|
72
|
+
object_fields << ui.color("Domain:", :cyan)
|
73
|
+
object_fields << v['domain']
|
74
|
+
object_fields << ui.color("State:", :cyan)
|
75
|
+
object_fields << v['state']
|
76
|
+
object_fields << ui.color("VMName:", :cyan)
|
77
|
+
object_fields << v['vmname']
|
78
|
+
object_fields << ui.color("VMState:", :cyan)
|
79
|
+
object_fields << v['vmstate']
|
80
|
+
|
81
|
+
puts "\n"
|
82
|
+
puts ui.list(object_fields, :uneven_columns_across, 2)
|
83
|
+
puts "\n"
|
84
|
+
end
|
85
|
+
|
86
|
+
def confirm_action(question)
|
87
|
+
return true if locate_config_value(:yes)
|
88
|
+
result = ui.ask_question(question, :default => "Y" )
|
89
|
+
if result == "Y" || result == "y" then
|
90
|
+
return true
|
91
|
+
else
|
92
|
+
return false
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
@@ -72,7 +72,7 @@ module CloudstackClient
|
|
72
72
|
end
|
73
73
|
project['id']
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
##
|
77
77
|
# Finds the server with the specified name.
|
78
78
|
|
@@ -103,7 +103,7 @@ module CloudstackClient
|
|
103
103
|
return ssh_rule['ipaddress'] if ssh_rule
|
104
104
|
|
105
105
|
winrm_rule = get_winrm_port_forwarding_rule(server, cached_rules)
|
106
|
-
return winrm_rule['ipaddress'] if winrm_rule
|
106
|
+
return winrm_rule['ipaddress'] if winrm_rule
|
107
107
|
|
108
108
|
#check for static NAT
|
109
109
|
if cached_nat
|
@@ -468,6 +468,45 @@ module CloudstackClient
|
|
468
468
|
nil
|
469
469
|
end
|
470
470
|
|
471
|
+
##
|
472
|
+
# Finds the volume with the specified name.
|
473
|
+
#
|
474
|
+
|
475
|
+
def get_volume(name)
|
476
|
+
params = {
|
477
|
+
'command' => 'listVolumes',
|
478
|
+
'name' => name
|
479
|
+
}
|
480
|
+
json = send_request(params)
|
481
|
+
volumes = json['volume']
|
482
|
+
|
483
|
+
if !volumes || volumes.empty? then
|
484
|
+
return nil
|
485
|
+
end
|
486
|
+
volume = volumes.select { |item| name == item['name'] }
|
487
|
+
volume.first
|
488
|
+
end
|
489
|
+
|
490
|
+
##
|
491
|
+
# Deletes the volume with the specified name.
|
492
|
+
#
|
493
|
+
|
494
|
+
def delete_volume(name)
|
495
|
+
volume = get_volume(name)
|
496
|
+
if !volume || !volume['id'] then
|
497
|
+
puts "\nError: Volume '#{name}' does not exist"
|
498
|
+
exit 1
|
499
|
+
end
|
500
|
+
|
501
|
+
params = {
|
502
|
+
'command' => 'deleteVolume',
|
503
|
+
'id' => volume['id']
|
504
|
+
}
|
505
|
+
|
506
|
+
json = send_request(params)
|
507
|
+
json['success']
|
508
|
+
end
|
509
|
+
|
471
510
|
##
|
472
511
|
# Lists all templates that match the specified filter.
|
473
512
|
#
|
@@ -679,7 +718,7 @@ module CloudstackClient
|
|
679
718
|
end
|
680
719
|
|
681
720
|
def list_public_ip_addresses(listall=false)
|
682
|
-
params = { 'command' => 'listPublicIpAddresses' }
|
721
|
+
params = { 'command' => 'listPublicIpAddresses' }
|
683
722
|
params['listall'] = listall
|
684
723
|
|
685
724
|
json = send_request(params)
|
@@ -793,8 +832,8 @@ module CloudstackClient
|
|
793
832
|
r['publicport'] == '22'
|
794
833
|
}.first
|
795
834
|
end
|
796
|
-
|
797
|
-
##
|
835
|
+
|
836
|
+
##
|
798
837
|
# Gets the WINRM port forwarding rule for the specified server.
|
799
838
|
|
800
839
|
def get_winrm_port_forwarding_rule(server, cached_rules=nil)
|
@@ -875,16 +914,16 @@ module CloudstackClient
|
|
875
914
|
uri = URI.parse(url)
|
876
915
|
|
877
916
|
http = http_client_builder.new(uri.host, uri.port)
|
878
|
-
|
917
|
+
|
879
918
|
if uri.scheme == "https"
|
880
919
|
http.use_ssl = true
|
881
920
|
# Still need to do some testing on SSL, so will fix this later
|
882
921
|
if @no_ssl_verify
|
883
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
922
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
884
923
|
else
|
885
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
924
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
886
925
|
end
|
887
|
-
end
|
926
|
+
end
|
888
927
|
request = Net::HTTP::Get.new(uri.request_uri)
|
889
928
|
response = http.request(request)
|
890
929
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cloudstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.18
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ryan Holmes
|
@@ -13,28 +12,25 @@ authors:
|
|
13
12
|
autorequire:
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
|
-
date: 2014-
|
15
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
17
16
|
dependencies:
|
18
17
|
- !ruby/object:Gem::Dependency
|
19
18
|
name: chef
|
20
19
|
requirement: !ruby/object:Gem::Requirement
|
21
|
-
none: false
|
22
20
|
requirements:
|
23
|
-
- -
|
21
|
+
- - ~>
|
24
22
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
23
|
+
version: '11.0'
|
26
24
|
type: :runtime
|
27
25
|
prerelease: false
|
28
26
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
27
|
requirements:
|
31
|
-
- -
|
28
|
+
- - ~>
|
32
29
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
30
|
+
version: '11.0'
|
34
31
|
- !ruby/object:Gem::Dependency
|
35
32
|
name: knife-windows
|
36
33
|
requirement: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
34
|
requirements:
|
39
35
|
- - ! '>='
|
40
36
|
- !ruby/object:Gem::Version
|
@@ -42,7 +38,6 @@ dependencies:
|
|
42
38
|
type: :runtime
|
43
39
|
prerelease: false
|
44
40
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
41
|
requirements:
|
47
42
|
- - ! '>='
|
48
43
|
- !ruby/object:Gem::Version
|
@@ -64,73 +59,73 @@ files:
|
|
64
59
|
- CHANGES.rdoc
|
65
60
|
- README.rdoc
|
66
61
|
- LICENSE
|
67
|
-
- lib/chef/knife/
|
68
|
-
- lib/chef/knife/
|
69
|
-
- lib/chef/knife/
|
70
|
-
- lib/chef/knife/
|
71
|
-
- lib/chef/knife/
|
72
|
-
- lib/chef/knife/cs_disk_list.rb
|
73
|
-
- lib/chef/knife/cs_template_extract.rb
|
62
|
+
- lib/chef/knife/cs_keypair_delete.rb
|
63
|
+
- lib/chef/knife/cs_router_list.rb
|
64
|
+
- lib/chef/knife/cs_keypair_create.rb
|
65
|
+
- lib/chef/knife/cs_forwardrule_create.rb
|
66
|
+
- lib/chef/knife/cs_service_list.rb
|
74
67
|
- lib/chef/knife/cs_server_list.rb
|
75
|
-
- lib/chef/knife/
|
68
|
+
- lib/chef/knife/cs_volume_delete.rb
|
76
69
|
- lib/chef/knife/cs_host_list.rb
|
70
|
+
- lib/chef/knife/cs_stack_create.rb
|
71
|
+
- lib/chef/knife/cs_zone_list.rb
|
72
|
+
- lib/chef/knife/cs_server_create.rb
|
77
73
|
- lib/chef/knife/cs_network_list.rb
|
78
|
-
- lib/chef/knife/cs_oscategory_list.rb
|
79
|
-
- lib/chef/knife/cs_config_list.rb
|
80
|
-
- lib/chef/knife/cs_domain_list.rb
|
81
74
|
- lib/chef/knife/cs_hosts.rb
|
82
|
-
- lib/chef/knife/
|
83
|
-
- lib/chef/knife/
|
84
|
-
- lib/chef/knife/
|
85
|
-
- lib/chef/knife/
|
86
|
-
- lib/chef/knife/
|
87
|
-
- lib/chef/knife/cs_server_create.rb
|
88
|
-
- lib/chef/knife/cs_server_delete.rb
|
89
|
-
- lib/chef/knife/cs_template_list.rb
|
75
|
+
- lib/chef/knife/cs_server_add_nic.rb
|
76
|
+
- lib/chef/knife/cs_firewallrule_create.rb
|
77
|
+
- lib/chef/knife/cs_server_start.rb
|
78
|
+
- lib/chef/knife/cs_domain_list.rb
|
79
|
+
- lib/chef/knife/cs_disk_list.rb
|
90
80
|
- lib/chef/knife/cs_publicip_list.rb
|
91
|
-
- lib/chef/knife/
|
81
|
+
- lib/chef/knife/cs_config_list.rb
|
82
|
+
- lib/chef/knife/cs_iso_list.rb
|
83
|
+
- lib/chef/knife/cs_template_list.rb
|
84
|
+
- lib/chef/knife/cs_securitygroup_list.rb
|
85
|
+
- lib/chef/knife/cs_user_list.rb
|
86
|
+
- lib/chef/knife/cs_base.rb
|
87
|
+
- lib/chef/knife/cs_template_create.rb
|
92
88
|
- lib/chef/knife/cs_server_reboot.rb
|
93
|
-
- lib/chef/knife/
|
94
|
-
- lib/chef/knife/cs_keypair_delete.rb
|
89
|
+
- lib/chef/knife/cs_ostype_list.rb
|
95
90
|
- lib/chef/knife/cs_baselist.rb
|
96
|
-
- lib/chef/knife/cs_router_list.rb
|
97
|
-
- lib/chef/knife/cs_firewallrule_create.rb
|
98
|
-
- lib/chef/knife/cs_account_list.rb
|
99
|
-
- lib/chef/knife/cs_server_start.rb
|
100
|
-
- lib/chef/knife/cs_keypair_list.rb
|
101
91
|
- lib/chef/knife/cs_server_stop.rb
|
92
|
+
- lib/chef/knife/cs_pod_list.rb
|
93
|
+
- lib/chef/knife/cs_server_delete.rb
|
94
|
+
- lib/chef/knife/cs_cluster_list.rb
|
95
|
+
- lib/chef/knife/cs_template_register.rb
|
102
96
|
- lib/chef/knife/cs_stack_delete.rb
|
103
|
-
- lib/chef/knife/
|
104
|
-
- lib/chef/knife/cs_user_list.rb
|
105
|
-
- lib/chef/knife/cs_volume_list.rb
|
106
|
-
- lib/chef/knife/cs_stack_create.rb
|
107
|
-
- lib/chef/knife/cs_keypair_create.rb
|
97
|
+
- lib/chef/knife/cs_aag_list.rb
|
108
98
|
- lib/chef/knife/cs_firewallrule_list.rb
|
109
|
-
- lib/chef/knife/
|
110
|
-
- lib/chef/knife/
|
99
|
+
- lib/chef/knife/cs_server_remove_nic.rb
|
100
|
+
- lib/chef/knife/cs_keypair_list.rb
|
101
|
+
- lib/chef/knife/cs_volume_list.rb
|
102
|
+
- lib/chef/knife/cs_template_extract.rb
|
103
|
+
- lib/chef/knife/cs_account_list.rb
|
104
|
+
- lib/chef/knife/cs_oscategory_list.rb
|
105
|
+
- lib/chef/knife/cs_volume_create.rb
|
106
|
+
- lib/chef/knife/cs_project_list.rb
|
111
107
|
- lib/knife-cloudstack/connection.rb
|
112
108
|
homepage: http://cloudstack.org/
|
113
109
|
licenses: []
|
110
|
+
metadata: {}
|
114
111
|
post_install_message:
|
115
112
|
rdoc_options: []
|
116
113
|
require_paths:
|
117
114
|
- lib
|
118
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
116
|
requirements:
|
121
117
|
- - ! '>='
|
122
118
|
- !ruby/object:Gem::Version
|
123
119
|
version: '0'
|
124
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
121
|
requirements:
|
127
122
|
- - ! '>='
|
128
123
|
- !ruby/object:Gem::Version
|
129
124
|
version: '0'
|
130
125
|
requirements: []
|
131
126
|
rubyforge_project:
|
132
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 2.1.11
|
133
128
|
signing_key:
|
134
|
-
specification_version:
|
129
|
+
specification_version: 4
|
135
130
|
summary: A knife plugin for the CloudStack API
|
136
131
|
test_files: []
|