ucloudstack 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES.rdoc
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
= Changes
|
|
2
2
|
|
|
3
|
+
== 2012-09-20
|
|
4
|
+
* change name ucloudstack because original modified for adopting KT ucloud
|
|
5
|
+
* https support added
|
|
6
|
+
* template list command added
|
|
7
|
+
* server create modified
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
== 2012-05-17 (0.0.12)
|
|
4
11
|
* Adding option to disable public IP allocation on server create
|
|
5
12
|
https://github.com/CloudStack/knife-cloudstack/pull/8
|
|
@@ -58,7 +58,8 @@ module KnifeCloudstack
|
|
|
58
58
|
product_list << product['zoneid']
|
|
59
59
|
product_list << product['zonedesc']
|
|
60
60
|
end
|
|
61
|
-
puts ui.list(product_list, :columns_across, 9)
|
|
61
|
+
#puts ui.list(product_list, :columns_across, 9)
|
|
62
|
+
puts products.to_json
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
def locate_config_value(key)
|
|
@@ -23,7 +23,7 @@ module KnifeCloudstack
|
|
|
23
23
|
class CsServerCreate < Chef::Knife
|
|
24
24
|
|
|
25
25
|
# Seconds to delay between detecting ssh and initiating the bootstrap
|
|
26
|
-
BOOTSTRAP_DELAY =
|
|
26
|
+
BOOTSTRAP_DELAY = 5.0
|
|
27
27
|
|
|
28
28
|
# Seconds to wait between ssh pings
|
|
29
29
|
SSH_POLL_INTERVAL = 2
|
|
@@ -57,6 +57,12 @@ module KnifeCloudstack
|
|
|
57
57
|
:long => "--zone ZONE",
|
|
58
58
|
:description => "The CloudStack zone for the server",
|
|
59
59
|
:proc => Proc.new { |z| Chef::Config[:knife][:cloudstack_zone] = z }
|
|
60
|
+
|
|
61
|
+
option :cloudstack_disk,
|
|
62
|
+
:short => "-D DISK",
|
|
63
|
+
:long => "--disk DISK",
|
|
64
|
+
:description => "The CloudStack disk for the server",
|
|
65
|
+
:proc => Proc.new { |i| Chef::Config[:knife][:cloudstack_disk] = i }
|
|
60
66
|
|
|
61
67
|
option :cloudstack_networks,
|
|
62
68
|
:short => "-W NETWORKS",
|
|
@@ -68,7 +74,6 @@ module KnifeCloudstack
|
|
|
68
74
|
option :public_ip,
|
|
69
75
|
:long => "--[no-]public-ip",
|
|
70
76
|
:description => "Allocate a public IP for this server",
|
|
71
|
-
:boolean => true,
|
|
72
77
|
:default => true
|
|
73
78
|
|
|
74
79
|
option :chef_node_name,
|
|
@@ -145,10 +150,9 @@ module KnifeCloudstack
|
|
|
145
150
|
:default => false
|
|
146
151
|
|
|
147
152
|
option :no_bootstrap,
|
|
148
|
-
:long => "--no-bootstrap",
|
|
153
|
+
:long => "--[no-]bootstrap",
|
|
149
154
|
:description => "Disable Chef bootstrap",
|
|
150
|
-
:
|
|
151
|
-
:default => false
|
|
155
|
+
:default => true
|
|
152
156
|
|
|
153
157
|
option :port_rules,
|
|
154
158
|
:short => "-p PORT_RULES",
|
|
@@ -182,34 +186,43 @@ module KnifeCloudstack
|
|
|
182
186
|
locate_config_value(:cloudstack_service),
|
|
183
187
|
locate_config_value(:cloudstack_template),
|
|
184
188
|
locate_config_value(:cloudstack_zone),
|
|
189
|
+
locate_config_value(:cloudstack_disk),
|
|
185
190
|
locate_config_value(:cloudstack_networks)
|
|
186
191
|
)
|
|
192
|
+
|
|
193
|
+
#puts "#"*100
|
|
194
|
+
#puts server
|
|
195
|
+
#puts "#"*100
|
|
187
196
|
|
|
188
|
-
|
|
197
|
+
private_ip = find_or_create_public_ip(server, connection)
|
|
189
198
|
|
|
190
199
|
puts "\n\n"
|
|
191
200
|
puts "#{ui.color("Name", :cyan)}: #{server['name']}"
|
|
192
|
-
puts "#{ui.color("
|
|
201
|
+
puts "#{ui.color("Private IP", :cyan)}: #{private_ip}"
|
|
193
202
|
|
|
194
|
-
return if config[:no_bootstrap]
|
|
195
203
|
|
|
196
204
|
print "\n#{ui.color("Waiting for sshd", :magenta)}"
|
|
197
205
|
|
|
198
|
-
print(".") until is_ssh_open?(
|
|
206
|
+
print(".") until is_ssh_open?(private_ip) {
|
|
199
207
|
sleep BOOTSTRAP_DELAY
|
|
200
208
|
puts "\n"
|
|
201
209
|
}
|
|
202
210
|
|
|
203
|
-
|
|
211
|
+
server_info = { 'hostname' => hostname, 'private_ip' => private_ip, 'password' => server['password'] }
|
|
212
|
+
puts "\n"
|
|
213
|
+
|
|
214
|
+
puts "server_info :"+server_info.to_json+"\n"
|
|
204
215
|
|
|
205
|
-
|
|
216
|
+
return unless config[:no_bootstrap]
|
|
217
|
+
|
|
218
|
+
config[:ssh_password] = server['password']
|
|
219
|
+
bootstrap_for_node(private_ip).run
|
|
206
220
|
|
|
207
221
|
puts "\n"
|
|
208
222
|
puts "#{ui.color("Name", :cyan)}: #{server['name']}"
|
|
209
|
-
puts "#{ui.color("Public IP", :cyan)}: #{
|
|
223
|
+
puts "#{ui.color("Public IP", :cyan)}: #{private_ip}"
|
|
210
224
|
puts "#{ui.color("Environment", :cyan)}: #{config[:environment] || '_default'}"
|
|
211
225
|
puts "#{ui.color("Run List", :cyan)}: #{config[:run_list].join(', ')}"
|
|
212
|
-
|
|
213
226
|
end
|
|
214
227
|
|
|
215
228
|
def validate_options
|
|
@@ -227,10 +240,10 @@ config[:ssh_password] = server['password']
|
|
|
227
240
|
identity_file = locate_config_value :identity_file
|
|
228
241
|
ssh_user = locate_config_value :ssh_user
|
|
229
242
|
ssh_password = locate_config_value :ssh_password
|
|
230
|
-
unless identity_file || (ssh_user && ssh_password)
|
|
231
|
-
|
|
243
|
+
#unless identity_file || (ssh_user && ssh_password)
|
|
244
|
+
# ui.error("You must specify either an ssh identity file or an ssh user and password")
|
|
232
245
|
#exit 1
|
|
233
|
-
end
|
|
246
|
+
#end
|
|
234
247
|
end
|
|
235
248
|
|
|
236
249
|
|
|
@@ -71,7 +71,9 @@ module KnifeCloudstack
|
|
|
71
71
|
|
|
72
72
|
filter = config[:filter]
|
|
73
73
|
templates = connection.list_templates(filter)
|
|
74
|
+
|
|
74
75
|
templates.each do |t|
|
|
76
|
+
puts t
|
|
75
77
|
template_list << t['name']
|
|
76
78
|
template_list << (human_file_size(t['size']) || 'Unknown')
|
|
77
79
|
template_list << t['zonename']
|
|
@@ -110,8 +110,8 @@ module CloudstackClient
|
|
|
110
110
|
##
|
|
111
111
|
# Deploys a new server using the specified parameters.
|
|
112
112
|
|
|
113
|
-
def create_server(host_name, service_name, template_name, zone_name
|
|
114
|
-
|
|
113
|
+
def create_server(host_name, service_name, template_name, zone_name, disk_name, network_names=[])
|
|
114
|
+
|
|
115
115
|
if host_name then
|
|
116
116
|
if get_server(host_name) then
|
|
117
117
|
puts "Error: Server '#{host_name}' already exists."
|
|
@@ -164,8 +164,9 @@ module CloudstackClient
|
|
|
164
164
|
#'serviceOfferingId' => service['id'],
|
|
165
165
|
'templateId' => template_name,
|
|
166
166
|
#'templateId' => template['id'],
|
|
167
|
-
'zoneId' => zone_name
|
|
167
|
+
'zoneId' => zone_name,
|
|
168
168
|
#'zoneId' => zone['id'],
|
|
169
|
+
'diskofferingid' => disk_name
|
|
169
170
|
#'networkids' => network_ids.join(',')
|
|
170
171
|
}
|
|
171
172
|
params['name'] = host_name if host_name
|
|
@@ -555,7 +556,7 @@ module CloudstackClient
|
|
|
555
556
|
def send_request(params)
|
|
556
557
|
params['response'] = 'json'
|
|
557
558
|
params['apiKey'] = @api_key
|
|
558
|
-
|
|
559
|
+
|
|
559
560
|
params_arr = []
|
|
560
561
|
params.sort.each { |elem|
|
|
561
562
|
params_arr << elem[0].to_s + '=' + elem[1].to_s
|
|
@@ -598,17 +599,18 @@ module CloudstackClient
|
|
|
598
599
|
def send_async_request(params)
|
|
599
600
|
|
|
600
601
|
json = send_request(params)
|
|
601
|
-
|
|
602
|
+
|
|
602
603
|
params = {
|
|
603
604
|
'command' => 'queryAsyncJobResult',
|
|
604
605
|
'jobId' => json['jobid']
|
|
605
606
|
}
|
|
606
607
|
|
|
607
608
|
max_tries = (ASYNC_TIMEOUT / ASYNC_POLL_INTERVAL).round
|
|
609
|
+
sleep 5
|
|
608
610
|
max_tries.times do
|
|
609
611
|
json = send_request(params)
|
|
610
612
|
status = json['jobstatus']
|
|
611
|
-
|
|
613
|
+
|
|
612
614
|
print "."
|
|
613
615
|
|
|
614
616
|
if status == 1 then
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: ucloudstack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.0.
|
|
5
|
+
version: 0.0.2
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Ryan Holmes
|
|
@@ -13,7 +13,7 @@ autorequire:
|
|
|
13
13
|
bindir: bin
|
|
14
14
|
cert_chain: []
|
|
15
15
|
|
|
16
|
-
date: 2012-
|
|
16
|
+
date: 2012-09-20 00:00:00 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: chef
|
|
@@ -88,3 +88,4 @@ specification_version: 3
|
|
|
88
88
|
summary: A knife plugin for the ucloud API
|
|
89
89
|
test_files: []
|
|
90
90
|
|
|
91
|
+
has_rdoc: true
|