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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d099b0bfa2e3e253687b229068afb8bd7db8c26c
4
- data.tar.gz: 9834e72d1fc6f4fea8d3e6aa8483ecf05df6a592
3
+ metadata.gz: ffadc0abeb36e96de2834f68f1f892685a34ef55
4
+ data.tar.gz: 8977041739bfc80f370c07d8dde52418b744e626
5
5
  SHA512:
6
- metadata.gz: 73dac4d635ea0c72e53f09a1d7a71f99591a188aa6c3f47327c737d0024defe095c913106cac6a85dd0b0df3826082a89bbccae061035b8104ee326e57665550
7
- data.tar.gz: 665f5287031e7065eaf49372cbc9679cbb9da07e2a0a92a668bd7eddc3d85ac1462ad974222b7aab0b6e4d6afd09615d6db7a2cf27cb6a5272b7f86976498a8c
6
+ metadata.gz: 8400276d74958d7c19f8cf1649360190339faa317145b91cd9f3845618e84375e574ab43ad4585da9c8476d1f9feeffd04c60b4a33d5872769489a3cafafb98a
7
+ data.tar.gz: 1e60b27a881ff70e68c6add4a7e7801731f8ac37ab366457c616dcc8036e657b8550cd227ab548923309e832bbd69a6f9291abff293d4f36640ab1d6d72194b1
data/Gemfile.lock CHANGED
@@ -6,7 +6,7 @@ PATH
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- cloudstack-cli (1.5.7)
9
+ cloudstack-cli (1.5.8)
10
10
  cloudstack_client (~> 1.4.3)
11
11
  thor (~> 0.19)
12
12
 
@@ -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: 1}
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
- jobs = []
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
- jobs << {
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(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}/#{jobs.size} (#{t_elapsed}s)", :magenta
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
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "1.5.7"
2
+ VERSION = "1.5.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm