cloudstack-cli 1.5.8 → 1.5.9

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: ffadc0abeb36e96de2834f68f1f892685a34ef55
4
- data.tar.gz: 8977041739bfc80f370c07d8dde52418b744e626
3
+ metadata.gz: c3825bffdc7d610ccd33d5ea01d48804ad3caeaf
4
+ data.tar.gz: 23e2821aaf38b61cbc98091a460f91e42d75ebb9
5
5
  SHA512:
6
- metadata.gz: 8400276d74958d7c19f8cf1649360190339faa317145b91cd9f3845618e84375e574ab43ad4585da9c8476d1f9feeffd04c60b4a33d5872769489a3cafafb98a
7
- data.tar.gz: 1e60b27a881ff70e68c6add4a7e7801731f8ac37ab366457c616dcc8036e657b8550cd227ab548923309e832bbd69a6f9291abff293d4f36640ab1d6d72194b1
6
+ metadata.gz: 2eca64f2d69c815e19fbf7696087efc5a9a0f3f743acec88c5ea26c8b6a155510f1471b977bac4d6113dd351148abf393402698dec05ab4f938997be8c30a5cb
7
+ data.tar.gz: 7c43cc6ce81a7df4c7bffc94a967786fc76ff50da12951ec2eafda751e9da1541a83263c4c69870f525338e9687715b4a0b7c0f1244df99a540d680fab880ad2
data/Gemfile.lock CHANGED
@@ -6,7 +6,7 @@ PATH
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- cloudstack-cli (1.5.8)
9
+ cloudstack-cli (1.5.9)
10
10
  cloudstack_client (~> 1.4.3)
11
11
  thor (~> 0.19)
12
12
 
@@ -104,9 +104,7 @@ class VirtualMachine < CloudstackCli::Base
104
104
  vm_options_to_params
105
105
  say "Start deploying virtual machine#{"s" if names.size > 1}...", :green
106
106
  jobs = names.map do |name|
107
- if virtual_machine = client.list_virtual_machines(
108
- name: name, project_id: options[:project_id]
109
- ).first
107
+ if virtual_machine = find_vm_by_name(name)
110
108
  say "virtual machine #{name} (#{virtual_machine["state"]}) already exists.", :yellow
111
109
  job = {id: 0, name: "Create virtual machine #{name}", status: 3}
112
110
  else
@@ -118,26 +116,27 @@ class VirtualMachine < CloudstackCli::Base
118
116
  job
119
117
  end
120
118
  watch_jobs(jobs)
121
- if options[:port_rules].size > 0
119
+ successful_jobs = jobs.count {|job| job[:status] == 1 }
120
+ if options[:port_rules].size > 0 && successful_jobs > 0
122
121
  say "Create port forwarding rules...", :green
123
122
  pjobs = []
124
123
  names.each do |name|
125
- virtual_machine = client.list_virtual_machine(name: name, project_id: options[:project_id]).first
126
- create_port_rules(virtual_machine, options[:port_rules], false).each_with_index do |job_id, index|
124
+ vm = client.list_virtual_machines(name: name, project_id: options[:project_id]).first
125
+ create_port_rules(vm, options[:port_rules], false).each_with_index do |job_id, index|
127
126
  pjobs << {
128
127
  id: job_id,
129
- name: "Create port forwarding ##{index + 1} rules for virtual machine #{virtual_machine['name']}"
128
+ name: "Create port forwarding ##{index + 1} rules for VM #{vm['name']}"
130
129
  }
131
130
  end
132
131
  end
133
132
  watch_jobs(pjobs)
134
133
  end
135
134
  say "Finished.", :green
136
- if (jobs.count {|job| job[:status] == 1 } > 0) && yes?("Display password(s) for VM(s)? [y/N]:", :yellow)
135
+ if successful_jobs > 0 && yes?("Display password(s) for VM(s)? [y/N]:", :yellow)
137
136
  table = []
138
137
  jobs.each do |job|
139
138
  data = client.query_async_job_result(jobid: job[:id])["jobresult"]["virtualmachine"] rescue nil
140
- table << [data["name"], data["password"]] if data
139
+ table << ["#{data["name"]}:", data["password"]] if data
141
140
  end
142
141
  print_table table
143
142
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "1.5.8"
2
+ VERSION = "1.5.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.8
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-21 00:00:00.000000000 Z
11
+ date: 2016-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake