vcloud-cli-utils 0.8.0 → 0.9.0

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: 84c5b9217176679b341cb302c9334855492961dc
4
- data.tar.gz: c137de0353479909bda37f65e3c222c43abc35e3
3
+ metadata.gz: a312c6aed92b3c9151557e72d87bb36f45426b4b
4
+ data.tar.gz: d7511060851404dcb422b4fcffce2ba9db6966b6
5
5
  SHA512:
6
- metadata.gz: 8d400391d4f33f95fb10e77ab64354255444b6d5471f578427e5aabf10a9b43903c7d75be8d1ff253afc97ace4a7f6cd5a0f58cde3a919fa154048867a7db260
7
- data.tar.gz: b2d81d529fd2aedb50b01ffc561392c91fd3c969ff40cd02a00cc7a3ddf52e5098cd5973ab2fd290fdac09b812252c22ff8bc7ccc96e31dd942ff9264b94f3f0
6
+ metadata.gz: 9055d663e99e701b220dbd9bda4d5d19995356bd8b05676fd31ba4ab59a0e9399075738c5cee759c90ed2710f89d6f7ae9e4e5d2e44206821b7194ff3299d0a8
7
+ data.tar.gz: f52fc4eacaa06e1e1ad037d930b818c9a86f021a7462ee1603cc6391644210fce090f15553224f373c6fa9851d0d12ef87b34cdc0a8f5d5438580421c9b329eb
@@ -1,3 +1,7 @@
1
+ v0.9.0
2
+
3
+ * vcloud-rename-vm tool added
4
+
1
5
  v0.8.0
2
6
 
3
7
  * Disk management tools implemented
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+
6
+ require 'vcloud/cli/utils'
7
+
8
+ Vcloud::CLI::Utils::RenameVm.run
@@ -14,3 +14,4 @@ require 'vcloud/cli/utils/attach_disk'
14
14
  require 'vcloud/cli/utils/detach_disk'
15
15
  require 'vcloud/cli/utils/delete_disk'
16
16
  require 'vcloud/cli/utils/get_vms_attached_to_disk'
17
+ require 'vcloud/cli/utils/rename_vm'
@@ -0,0 +1,67 @@
1
+ require 'methadone'
2
+ require 'vcloud/core'
3
+ require 'pp'
4
+
5
+ module Vcloud
6
+ module CLI
7
+ module Utils
8
+ class RenameVm
9
+
10
+ include Methadone::Main
11
+ include Methadone::CLILogging
12
+
13
+ def self.run
14
+
15
+ main do |identifier, name|
16
+ Fog.mock! if ENV['FOG_MOCK']
17
+ if identifier =~ /^vm-[-0-9a-f]+/
18
+ vapp = Vcloud::Core::Vapp.get_by_child_vm_id(identifier)
19
+ vm = Vcloud::Core::Vm.new(identifier, vapp)
20
+ elsif identifier =~ /^vapp-[-0-9a-f]+/
21
+ vapp = Vcloud::Core::Vapp.new(identifier)
22
+ vm_href = vapp.vms.first.fetch(:href)
23
+ vm = Vcloud::Core::Vm.new(vm_href.split('/').last, vapp)
24
+ else
25
+ vapp = Vcloud::Core::Vapp.get_by_name(identifier)
26
+ vm_href = vapp.vms.first.fetch(:href)
27
+ vm = Vcloud::Core::Vm.new(vm_href.split('/').last, vapp)
28
+ end
29
+
30
+ if options[:rename_to_match_vapp]
31
+ new_name = vapp.name
32
+ else
33
+ if name.nil?
34
+ raise "Need a name to rename the VM to!"
35
+ else
36
+ new_name = name
37
+ end
38
+ end
39
+
40
+ vm.update_name(new_name)
41
+
42
+ end
43
+
44
+ arg :identifier
45
+ arg :name, :optional
46
+
47
+ on("-r", "--rename_to_match_vapp", "Make the vm name match the vApp name")
48
+
49
+ description "
50
+ Renames a vCloud VM given by :identifier (existing name or ID).
51
+
52
+ If a 'name' parameter is specified, renames to that.
53
+
54
+ If --rename_to_match_vapp is specified, treat the identifier as a selector of the vApp, and
55
+ rename the VM to that.
56
+
57
+ If a vApp with multiple VMs is given, only the first is renamed.
58
+ "
59
+
60
+ go!
61
+
62
+ end
63
+ end
64
+
65
+ end
66
+ end
67
+ end
@@ -1,7 +1,7 @@
1
1
  module Vcloud
2
2
  module CLI
3
3
  module Utils
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcloud-cli-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Pountney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -137,6 +137,7 @@ executables:
137
137
  - vcloud-get-entity
138
138
  - vcloud-get_vms_attached_to-disk
139
139
  - vcloud-make-vapp-template
140
+ - vcloud-rename-vm
140
141
  - vcloud-start-vapp
141
142
  - vcloud-stop-vapp
142
143
  extensions: []
@@ -158,6 +159,7 @@ files:
158
159
  - bin/vcloud-get-entity
159
160
  - bin/vcloud-get_vms_attached_to-disk
160
161
  - bin/vcloud-make-vapp-template
162
+ - bin/vcloud-rename-vm
161
163
  - bin/vcloud-start-vapp
162
164
  - bin/vcloud-stop-vapp
163
165
  - lib/vcloud/cli/utils.rb
@@ -169,6 +171,7 @@ files:
169
171
  - lib/vcloud/cli/utils/get_entity.rb
170
172
  - lib/vcloud/cli/utils/get_vms_attached_to_disk.rb
171
173
  - lib/vcloud/cli/utils/make_vapp_template.rb
174
+ - lib/vcloud/cli/utils/rename_vm.rb
172
175
  - lib/vcloud/cli/utils/start_vapp.rb
173
176
  - lib/vcloud/cli/utils/stop_vapp.rb
174
177
  - lib/vcloud/cli/utils/version.rb