cloudstack-cli 1.3.1 → 1.3.2

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: dcc8b27372a5484703bb5d2abcacbaf10e9919a6
4
- data.tar.gz: cf28ee4aa1149427ca4f2bc4d17207f4c5347d4c
3
+ metadata.gz: b135fb12cf482f93c4abc4225736ed77aeaa01ae
4
+ data.tar.gz: 97d52147ad5f04e851d7cd0e97482b825a902566
5
5
  SHA512:
6
- metadata.gz: cc54fdd7737b8262ff72ca363ec5b34a42e256f20cb7bbf00a964b6cc9eaf0dd2af907c20a2996cb3648d53c03c199efe7e3d29e24b4c499093d945bf6add28f
7
- data.tar.gz: e4bb9fbbac32e6cfb39585d5e473f41f242f526728071584130398a8af47edd4cf7ad95a59072c120434413ff25097ae0366d0e2738567957a7f1ebd942f33c4
6
+ metadata.gz: 76745dde4dc529838b98f5bdae24de1746f451ecd9639b7e4ed38a5c9199d2a0c85fdc114b4cd5552730f5e5e32904faa865a22950f90c589f925aa606455ee3
7
+ data.tar.gz: bb85e0cf441565e0935541fd6f288c3653cae8e62461652fcbbfda2aecf76a8839de94b1ccd0539f67e79e3b06721c70f2c8a1b6e86b4cead8b2a7f138ceb630
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ PATH
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- cloudstack-cli (1.3.0)
10
+ cloudstack-cli (1.3.2)
11
11
  cloudstack_client (~> 1.2)
12
12
  multi_json (~> 1.11)
13
13
  thor (~> 0.19)
@@ -199,6 +199,67 @@ class VirtualMachine < CloudstackCli::Base
199
199
  puts
200
200
  end
201
201
 
202
+ desc "update NAME", "update a virtual machine"
203
+ option :project,
204
+ desc: "project of virtual machine"
205
+ option :force, type: :boolean,
206
+ desc: "update w/o asking for confirmation"
207
+ option :details, type: :hash,
208
+ desc: "details in key/value pairs."
209
+ option :display_name,
210
+ desc: "user generated name"
211
+ option :display_vm,
212
+ desc: "an optional field, whether to the display the vm to the end user or not"
213
+ option :group,
214
+ desc: "group of the virtual machine"
215
+ option :ha_enable, enum: %w(true false),
216
+ desc: "true if high-availability is enabled for the virtual machine, false otherwise"
217
+ option :instance_name,
218
+ desc: "instance name of the user vm"
219
+ option :is_dynamically_scalable,
220
+ desc: "true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory"
221
+ option :name,
222
+ desc: "new host name of the vm"
223
+ option :ostype_id,
224
+ desc: "the ID of the OS type that best represents this VM"
225
+ option :user_data,
226
+ desc: "an optional binary data that can be sent to the virtual machine upon a successful deployment."
227
+ def update(name)
228
+ resolve_project
229
+
230
+ unless vm = client.list_virtual_machines(
231
+ name: name, project_id: options[:project_id], listall: true
232
+ ).first
233
+ say "Virtual machine #{name} not found.", :red
234
+ exit 1
235
+ end
236
+
237
+ unless vm["state"].downcase == "stopped"
238
+ say "Virtual machine #{name} (#{vm["state"]}) must be in a stopped state.", :red
239
+ exit 1
240
+ end
241
+
242
+ unless options[:force] || yes?("Update virtual_machine #{name}? [y/N]:", :magenta)
243
+ exit
244
+ end
245
+
246
+ if options[:user_data]
247
+ # base64 encode user_data
248
+ options[:user_data] = [options[:user_data]].pack("m")
249
+ end
250
+
251
+ vm = client.update_virtual_machine(options.merge(id: vm['id']))
252
+
253
+ say "Virtual machine \"#{name}\" has been updated:", :green
254
+
255
+ table = vm.select do |k, _|
256
+ options.find {|k2, _| k2.gsub('_', '') == k }
257
+ end.map do |key, value|
258
+ [ set_color("#{key}:", :yellow), set_color("#{value}", :red) ]
259
+ end
260
+ print_table table
261
+ end
262
+
202
263
  no_commands do
203
264
 
204
265
  def print_virtual_machines(virtual_machines)
@@ -1,3 +1,3 @@
1
1
  module CloudstackCli
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
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.3.1
4
+ version: 1.3.2
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-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.4.5
151
+ rubygems_version: 2.4.5.1
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: cloudstack-cli CloudStack API client