cloudstack-cli 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cloudstack-cli/commands/virtual_machine.rb +12 -4
- data/lib/cloudstack-cli/helper.rb +3 -2
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffadc0abeb36e96de2834f68f1f892685a34ef55
|
4
|
+
data.tar.gz: 8977041739bfc80f370c07d8dde52418b744e626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8400276d74958d7c19f8cf1649360190339faa317145b91cd9f3845618e84375e574ab43ad4585da9c8476d1f9feeffd04c60b4a33d5872769489a3cafafb98a
|
7
|
+
data.tar.gz: 1e60b27a881ff70e68c6add4a7e7801731f8ac37ab366457c616dcc8036e657b8550cd227ab548923309e832bbd69a6f9291abff293d4f36640ab1d6d72194b1
|
data/Gemfile.lock
CHANGED
@@ -108,7 +108,7 @@ class VirtualMachine < CloudstackCli::Base
|
|
108
108
|
name: name, project_id: options[:project_id]
|
109
109
|
).first
|
110
110
|
say "virtual machine #{name} (#{virtual_machine["state"]}) already exists.", :yellow
|
111
|
-
job = {id: 0, name: "Create virtual machine #{name}", status:
|
111
|
+
job = {id: 0, name: "Create virtual machine #{name}", status: 3}
|
112
112
|
else
|
113
113
|
job = {
|
114
114
|
id: client.deploy_virtual_machine(options.merge(name: name), {sync: true})['jobid'],
|
@@ -120,19 +120,27 @@ class VirtualMachine < CloudstackCli::Base
|
|
120
120
|
watch_jobs(jobs)
|
121
121
|
if options[:port_rules].size > 0
|
122
122
|
say "Create port forwarding rules...", :green
|
123
|
-
|
123
|
+
pjobs = []
|
124
124
|
names.each do |name|
|
125
125
|
virtual_machine = client.list_virtual_machine(name: name, project_id: options[:project_id]).first
|
126
126
|
create_port_rules(virtual_machine, options[:port_rules], false).each_with_index do |job_id, index|
|
127
|
-
|
127
|
+
pjobs << {
|
128
128
|
id: job_id,
|
129
129
|
name: "Create port forwarding ##{index + 1} rules for virtual machine #{virtual_machine['name']}"
|
130
130
|
}
|
131
131
|
end
|
132
132
|
end
|
133
|
-
watch_jobs(
|
133
|
+
watch_jobs(pjobs)
|
134
134
|
end
|
135
135
|
say "Finished.", :green
|
136
|
+
if (jobs.count {|job| job[:status] == 1 } > 0) && yes?("Display password(s) for VM(s)? [y/N]:", :yellow)
|
137
|
+
table = []
|
138
|
+
jobs.each do |job|
|
139
|
+
data = client.query_async_job_result(jobid: job[:id])["jobresult"]["virtualmachine"] rescue nil
|
140
|
+
table << [data["name"], data["password"]] if data
|
141
|
+
end
|
142
|
+
print_table table
|
143
|
+
end
|
136
144
|
end
|
137
145
|
|
138
146
|
desc "destroy NAME [NAME2 ..]", "destroy virtual machine(s)"
|
@@ -15,7 +15,8 @@ module CloudstackCli
|
|
15
15
|
-1 => "waiting",
|
16
16
|
0 => "running",
|
17
17
|
1 => "completed",
|
18
|
-
2 => "error"
|
18
|
+
2 => "error",
|
19
|
+
3 => "aborted"
|
19
20
|
}
|
20
21
|
|
21
22
|
def watch_jobs(jobs)
|
@@ -120,7 +121,7 @@ module CloudstackCli
|
|
120
121
|
end
|
121
122
|
t_elapsed = opts[:t_start] ? (Time.now - opts[:t_start]).round(1) : 0
|
122
123
|
completed = jobs.select{|j| j[:status] == 1}.size
|
123
|
-
say "Completed: #{completed}
|
124
|
+
say "Completed: #{completed} of #{jobs.size} (#{t_elapsed}s)", :magenta
|
124
125
|
sleep opts[:sleeptime] || 0.1
|
125
126
|
spinner.push spinner.shift
|
126
127
|
spinner
|