rbvmomi 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/LICENSE +1 -1
  4. data/README.rdoc +20 -17
  5. data/Rakefile +3 -0
  6. data/devel/analyze-vim-declarations.rb +4 -0
  7. data/devel/analyze-xml.rb +3 -0
  8. data/devel/benchmark.rb +4 -0
  9. data/devel/collisions.rb +4 -0
  10. data/devel/merge-internal-vmodl.rb +4 -0
  11. data/devel/merge-manual-vmodl.rb +4 -0
  12. data/examples/annotate.rb +3 -0
  13. data/examples/cached_ovf_deploy.rb +4 -0
  14. data/examples/clone_vm.rb +4 -0
  15. data/examples/create_vm-1.9.rb +4 -0
  16. data/examples/create_vm.rb +4 -0
  17. data/examples/extraConfig.rb +3 -0
  18. data/examples/lease_tool.rb +4 -0
  19. data/examples/logbundle.rb +3 -0
  20. data/examples/logtail.rb +3 -0
  21. data/examples/nfs_datastore.rb +4 -0
  22. data/examples/power.rb +3 -0
  23. data/examples/readme-1.rb +3 -0
  24. data/examples/readme-2.rb +3 -0
  25. data/examples/screenshot.rb +3 -0
  26. data/examples/vdf.rb +3 -0
  27. data/examples/vm_drs_behavior.rb +4 -0
  28. data/lib/rbvmomi.rb +3 -1
  29. data/lib/rbvmomi/basic_types.rb +3 -1
  30. data/lib/rbvmomi/connection.rb +3 -1
  31. data/lib/rbvmomi/deserialization.rb +3 -1
  32. data/lib/rbvmomi/fault.rb +3 -1
  33. data/lib/rbvmomi/pbm.rb +3 -1
  34. data/lib/rbvmomi/sms.rb +3 -1
  35. data/lib/rbvmomi/sms/SmsStorageManager.rb +3 -0
  36. data/lib/rbvmomi/trivial_soap.rb +3 -1
  37. data/lib/rbvmomi/trollop.rb +3 -1
  38. data/lib/rbvmomi/type_loader.rb +3 -1
  39. data/lib/rbvmomi/utils/admission_control.rb +3 -0
  40. data/lib/rbvmomi/utils/deploy.rb +4 -1
  41. data/lib/rbvmomi/utils/leases.rb +4 -1
  42. data/lib/rbvmomi/utils/perfdump.rb +3 -0
  43. data/lib/rbvmomi/version.rb +4 -1
  44. data/lib/rbvmomi/vim.rb +11 -3
  45. data/lib/rbvmomi/vim/ComputeResource.rb +3 -0
  46. data/lib/rbvmomi/vim/Datacenter.rb +3 -0
  47. data/lib/rbvmomi/vim/Datastore.rb +3 -0
  48. data/lib/rbvmomi/vim/DynamicTypeMgrAllTypeInfo.rb +3 -0
  49. data/lib/rbvmomi/vim/DynamicTypeMgrDataTypeInfo.rb +4 -1
  50. data/lib/rbvmomi/vim/DynamicTypeMgrManagedTypeInfo.rb +3 -0
  51. data/lib/rbvmomi/vim/Folder.rb +3 -0
  52. data/lib/rbvmomi/vim/HostSystem.rb +3 -0
  53. data/lib/rbvmomi/vim/ManagedEntity.rb +3 -0
  54. data/lib/rbvmomi/vim/ManagedObject.rb +3 -0
  55. data/lib/rbvmomi/vim/ObjectContent.rb +3 -0
  56. data/lib/rbvmomi/vim/ObjectUpdate.rb +3 -0
  57. data/lib/rbvmomi/vim/OvfManager.rb +3 -0
  58. data/lib/rbvmomi/vim/PerfCounterInfo.rb +3 -1
  59. data/lib/rbvmomi/vim/PerformanceManager.rb +3 -0
  60. data/lib/rbvmomi/vim/PropertyCollector.rb +3 -0
  61. data/lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb +3 -0
  62. data/lib/rbvmomi/vim/ResourcePool.rb +3 -0
  63. data/lib/rbvmomi/vim/ServiceInstance.rb +3 -0
  64. data/lib/rbvmomi/vim/Task.rb +3 -0
  65. data/lib/rbvmomi/vim/VirtualMachine.rb +7 -0
  66. data/rbvmomi.gemspec +6 -2
  67. metadata +8 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 792a989dee04dc82e00befc5d3750cd5b7a5a0b7
4
- data.tar.gz: a63b2cf111ef48e571186fb6ce4b6e24682b546b
3
+ metadata.gz: 4ac40ac25d354b258a89ece0441d03f7f95fa672
4
+ data.tar.gz: c28c494a41960e27986a3f57919775b288f20463
5
5
  SHA512:
6
- metadata.gz: 231776027de490fc4ca2d1f52847ce99c81b1300508dc2679ed964c389653b1fa8a763a4c903c2a2ea3d936840b21c61beff140ee094cd629130f223f4a5e14f
7
- data.tar.gz: ea083510398b112268d4a515f7335837f586f0af059bc26773849161446889962b55b51297bb39eb28c8a4ac5c1d06be80b4275da7c065f7eae9b7669f84bcf4
6
+ metadata.gz: '0931dce171b497dec343f3eca7b1f7ff82081ae77be70fd2cedc7a8742d1e78702fd4a548cff827cdb8b53a56a4b67df54711d785e41d5623427d6fafc2e9912'
7
+ data.tar.gz: 3c012ef0838f2488b5136d20c23d7c990c8e0367fd2db3a59a67811b6f11e30d5486c23d6b6d5d4e528cc241146c8bd727fa25ab9ae1d79c15ec1b1fb12de1ba
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  source 'https://rubygems.org'
2
5
 
3
6
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -3,14 +3,14 @@
3
3
  {<img src="https://badge.fury.io/rb/rbvmomi.svg" alt="gem-version">}[https://rubygems.org/gems/rbvmomi]
4
4
  {<img src="https://travis-ci.org/vmware/rbvmomi.svg?branch=master" alt="travis-ci">}[http://travis-ci.org/vmware/rbvmomi]
5
5
 
6
- This is an Open Source community supported project at VMware. It is built and maintained by programmers like you!
6
+ This is a community-supported, open source project at VMware. It is built and maintained by programmers like you!
7
7
 
8
8
  == Introduction
9
9
 
10
10
  RbVmomi is a Ruby interface to the vSphere API. Like the Perl and Java SDKs,
11
- you can use it to manage ESX and VirtualCenter servers. The current release
12
- supports the vSphere 5.0 API. RbVmomi specific documentation is
13
- online[http://rdoc.info/github/rlane/rbvmomi/master/frames] and is meant to
11
+ you can use it to manage ESX and vCenter servers. The current release
12
+ supports the vSphere 6.0 API. RbVmomi specific documentation is
13
+ online[http://rdoc.info/github/vmware/rbvmomi/master/frames] and is meant to
14
14
  be used alongside the official documentation[http://pubs.vmware.com/vsphere-60/topic/com.vmware.sdk.doc/GUID-19793BCA-9EAB-42E2-8B9F-F9F2129E7741.html].
15
15
 
16
16
  == Installation
@@ -35,9 +35,10 @@ On both Ruby 1.9 and 1.8.7:
35
35
  A simple example of turning on a VM:
36
36
 
37
37
  require 'rbvmomi'
38
- vim = RbVmomi::VIM.connect host: 'foo', user: 'bar', password: 'baz'
39
- dc = vim.serviceInstance.find_datacenter("mydatacenter") or fail "datacenter not found"
40
- vm = dc.find_vm("myvm") or fail "VM not found"
38
+
39
+ vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
40
+ dc = vim.serviceInstance.find_datacenter('my_datacenter') || fail('datacenter not found')
41
+ vm = dc.find_vm('my_vm') || fail('VM not found')
41
42
  vm.PowerOnVM_Task.wait_for_completion
42
43
 
43
44
  This code uses several RbVmomi extensions to the vSphere API for concision. The
@@ -45,10 +46,11 @@ expanded snippet below uses only standard API calls and should be familiar to
45
46
  users of the Java SDK:
46
47
 
47
48
  require 'rbvmomi'
48
- vim = RbVmomi::VIM.connect host: 'foo', user: 'bar', password: 'baz'
49
- rootFolder = vim.serviceInstance.content.rootFolder
50
- dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == "mydatacenter" } or fail "datacenter not found"
51
- vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == "myvm" } or fail "VM not found"
49
+
50
+ vim = RbVmomi::VIM.connect(host: 'foo', user: 'bar', password: 'baz')
51
+ root_folder = vim.serviceInstance.content.rootFolder
52
+ dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == 'mydatacenter' } || fail('datacenter not found')
53
+ vm = dc.vmFolder.childEntity.grep(RbVmomi::VIM::VirtualMachine).find { |x| x.name == 'my_vm' } || fail('VM not found')
52
54
  task = vm.PowerOnVM_Task
53
55
  filter = vim.propertyCollector.CreateFilter(
54
56
  spec: {
@@ -58,13 +60,13 @@ users of the Java SDK:
58
60
  partialUpdates: false
59
61
  )
60
62
  ver = ''
61
- while true
63
+ loop do
62
64
  result = vim.propertyCollector.WaitForUpdates(version: ver)
63
65
  ver = result.version
64
- break if ['success', 'error'].member? task.info.state
66
+ break if ['success', 'error'].member?(task.info.state)
65
67
  end
66
68
  filter.DestroyPropertyFilter
67
- raise task.info.error if task.info.state == 'error'
69
+ raise(task.info.error) if task.info.state == 'error'
68
70
 
69
71
  As you can see, the extensions RbVmomi adds can dramatically decrease the code
70
72
  needed to perform simple tasks while still letting you use the full power of
@@ -88,9 +90,10 @@ A few important points:
88
90
 
89
91
  Built-in extensions are under +lib/rbvmomi/vim/+. You are encouraged to
90
92
  reopen VIM classes in your applications and add extensions of your own. If you
91
- write something generally useful please send it to me and I'll add it in.
93
+ write something generally useful please open a {pull request}[https://github.com/vmware/rbvmomi/pulls] so it
94
+ can be merged back in
92
95
 
93
96
  == Development
94
97
 
95
- Fork the project on Github and send me a merge request, or send a patch to
96
- rlane@vmware.com. RbVmomi developers hang out in #rbvmomi on Freenode.
98
+ Open an issue on the {issues page}[https://github.com/vmware/rbvmomi/issues] or
99
+ fork the project on {GitHub}[https://github.com/vmware/rbvmomi] and send a {pull request}[https://github.com/vmware/rbvmomi/pulls].
data/Rakefile CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'bundler/gem_tasks'
2
5
  require 'rake/testtask'
3
6
  require 'yard'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'nokogiri'
3
7
  require 'pp'
4
8
  # :usage => analyze-vim-declarations.rb vim-declarations.xml foo-declarations.xml vmodl.db
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'nokogiri'
2
5
 
3
6
  # removes line breaks and whitespace between xml nodes.
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'tempfile'
3
7
 
4
8
  if ENV['RBVMOMI_COVERAGE'] == '1'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  # Find collisions between VMODL property names and Ruby methods
3
7
  require 'rbvmomi'
4
8
  VIM = RbVmomi::VIM
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  # These types are not public and so may change between releases. Do not
3
7
  # use them directly.
4
8
 
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2013-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  # Manually merge two versions of vmodl.db
3
7
 
4
8
  public_vmodl_filename = ARGV[0] or abort "public vmodl filename required"
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'trollop'
2
5
  require 'rbvmomi'
3
6
  require 'rbvmomi/trollop'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'trollop'
2
5
  require 'rbvmomi'
3
6
  require 'rbvmomi/trollop'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  # @todo Retrieve ESX log bundles when run against VC.
2
5
  require 'trollop'
3
6
  require 'rbvmomi'
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  # Translation of example 2-2 from the vSphere SDK for Perl Programming Guide
2
5
  require 'trollop'
3
6
  require 'rbvmomi'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'trollop'
2
5
  require 'rbvmomi'
3
6
  require 'rbvmomi/trollop'
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'rbvmomi'
2
5
  require 'rbvmomi/trollop'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'rbvmomi'
2
5
  require 'rbvmomi/trollop'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  # Based on takeVMScreenshot.pl by William Lam
2
5
  require 'trollop'
3
6
  require 'rbvmomi'
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  # Translation of vGhetto vdf, originally by William Lam
2
5
  require 'trollop'
3
6
  require 'rbvmomi'
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
4
+ # SPDX-License-Identifier: MIT
5
+
2
6
  require 'trollop'
3
7
  require 'rbvmomi'
4
8
  require 'rbvmomi/trollop'
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  module RbVmomi
3
5
 
4
6
  # @private
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'pp'
3
5
  require 'set'
4
6
 
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'time'
3
5
  require 'date'
4
6
  require 'rbvmomi/trivial_soap'
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2011 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'time'
3
5
 
4
6
  module RbVmomi
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  module RbVmomi
3
5
 
4
6
  class Fault < StandardError
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'rbvmomi'
3
5
 
4
6
  module RbVmomi
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2013 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2013-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'rbvmomi'
3
5
  module RbVmomi
4
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2013-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::SMS::SmsStorageManager
2
5
 
3
6
  def RegisterProvider_Task2 providerSpec
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'rubygems'
3
5
  require 'builder'
4
6
  require 'nokogiri'
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2011 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'trollop'
3
5
 
4
6
  # Convenience methods for Trollop, Ruby's premier option parser.
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2010 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'set'
3
5
  require 'monitor'
4
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
 
2
5
  # An admission controlled resource scheduler for large scale vSphere deployments
3
6
  #
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'open-uri'
2
5
  require 'nokogiri'
3
6
  require 'rbvmomi'
@@ -311,4 +314,4 @@ class CachedOvfDeployer
311
314
 
312
315
  vm
313
316
  end
314
- end
317
+ end
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'yaml'
2
5
 
3
6
  # A class to manage VM leases
@@ -139,4 +142,4 @@ class LeaseTool
139
142
  out = Hash[out]
140
143
  out
141
144
  end
142
- end
145
+ end
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'set'
2
5
  require 'yaml'
3
6
 
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  module RbVmomi
2
- VERSION = '1.9.4'.freeze
5
+ VERSION = '1.9.5'.freeze
3
6
  end
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2011 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  require 'rbvmomi'
3
5
 
4
6
  # Win32::SSPI is part of core on Windows
@@ -40,7 +42,7 @@ class VIM < Connection
40
42
  opts[:rev] = '6.0' unless rev_given
41
43
  opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug
42
44
 
43
- new(opts).tap do |vim|
45
+ conn = new(opts).tap do |vim|
44
46
  unless opts[:cookie]
45
47
  if WIN32 && opts[:password] == ''
46
48
  # Attempt login by SSPI if no password specified on Windows
@@ -63,10 +65,16 @@ class VIM < Connection
63
65
  vim.rev = [rev, '6.0'].min
64
66
  end
65
67
  end
68
+
69
+ at_exit { conn.close }
70
+ conn
66
71
  end
67
72
 
68
73
  def close
69
- VIM::SessionManager(self, 'SessionManager').Logout rescue RbVmomi::Fault
74
+ serviceContent.sessionManager.Logout
75
+ rescue RbVmomi::Fault => e
76
+ $stderr.puts(e.message) if debug
77
+ ensure
70
78
  self.cookie = nil
71
79
  super
72
80
  end
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ComputeResource
2
5
  # Aggregate cluster information.
3
6
  #
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::Datacenter
2
5
  # Traverse the given inventory +path+ to find a ComputeResource.
3
6
  def find_compute_resource path
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  # @note +download+ and +upload+ require +curl+. If +curl+ is not in your +PATH+
2
5
  # then set the +CURL+ environment variable to point to it.
3
6
  # @todo Use an HTTP library instead of executing +curl+.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::DynamicTypeMgrAllTypeInfo
2
5
  def toRbvmomiTypeHash
3
6
  id2name = {}
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::DynamicTypeMgrDataTypeInfo
2
5
  def toRbvmomiTypeHash
3
6
  {
@@ -17,4 +20,4 @@ class RbVmomi::VIM::DynamicTypeMgrDataTypeInfo
17
20
  }
18
21
  }
19
22
  end
20
- end
23
+ end
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::DynamicTypeMgrManagedTypeInfo
2
5
  def toRbvmomiTypeHash
3
6
  {
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::Folder
2
5
  # Retrieve a child entity
3
6
  # @param name [String] Name of the child.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  module RbVmomi
2
5
 
3
6
  class VIM::HostSystem
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ManagedEntity
2
5
  # Retrieve the ancestors of the entity.
3
6
  # @return [Array] Ancestors of this entity, starting with the root.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ManagedObject
2
5
  # Wait for updates on an object until a condition becomes true.
3
6
  #
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ObjectContent
2
5
  # Represent this ObjectContent as a hash.
3
6
  # @return [Hash] A hash from property paths to values.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ObjectUpdate
2
5
  # Represent this ObjectUpdate as a hash.
3
6
  # @return [Hash] A hash from property paths to values.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  # @note +deployOVF+ and requires +curl+. If +curl+ is not in your +PATH+
2
5
  # then set the +CURL+ environment variable to point to it.
3
6
  # @todo Use an HTTP library instead of executing +curl+.
@@ -1,4 +1,6 @@
1
- # Copyright (c) 2011 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2012-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  require 'date'
2
5
 
3
6
  class Time
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::PropertyCollector
2
5
  def collectMultiple objs, *pathSet
3
6
  return {} if objs.empty?
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  module RbVmomi
2
5
 
3
6
  class VIM::ReflectManagedMethodExecuter
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ResourcePool
2
5
  # Retrieve a child ResourcePool.
3
6
  # @param name [String] Name of the child.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::ServiceInstance
2
5
  # Retrieve a Datacenter.
3
6
  # If no path is given the first datacenter will be returned.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::Task
2
5
  # Wait for a task to finish.
3
6
  # @return +info.result+ on success.
@@ -1,9 +1,16 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  class RbVmomi::VIM::VirtualMachine
2
5
  # Retrieve the MAC addresses for all virtual NICs.
3
6
  # @return [Hash] Keyed by device label.
4
7
  def macs
5
8
  Hash[self.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).map { |x| [x.deviceInfo.label, x.macAddress] }]
6
9
  end
10
+
11
+ def network
12
+ Hash[self.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).map { |x| [x.deviceInfo.label, x.deviceInfo.summary] }]
13
+ end
7
14
 
8
15
  # Retrieve all virtual disk devices.
9
16
  # @return [Array] Array of virtual disk devices.
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
1
4
  $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
2
5
 
3
6
  require 'rbvmomi/version'
@@ -8,14 +11,15 @@ Gem::Specification.new do |spec|
8
11
  spec.version = RbVmomi::VERSION
9
12
 
10
13
  spec.authors = ['Rich Lane', 'Christian Dickmann']
11
- spec.email = 'jr@garciaole.com'
14
+ spec.email = 'jrg@vmware.com'
12
15
  spec.homepage = 'https://github.com/vmware/rbvmomi'
16
+ spec.license = 'MIT'
13
17
 
14
18
  spec.bindir = 'exe'
15
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^test\//) }
16
20
  spec.executables << 'rbvmomish'
17
21
 
18
- spec.add_runtime_dependency('builder', '~> 3.2')
22
+ spec.add_runtime_dependency('builder', '~> 3.0')
19
23
  spec.add_runtime_dependency('json', '>= 1.8')
20
24
  spec.add_runtime_dependency('nokogiri', '~> 1.5')
21
25
  spec.add_runtime_dependency('trollop', '~> 2.1')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbvmomi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.4
4
+ version: 1.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich Lane
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-10-07 00:00:00.000000000 Z
12
+ date: 2017-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '3.2'
20
+ version: '3.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '3.2'
27
+ version: '3.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +124,7 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: '2.5'
126
126
  description:
127
- email: jr@garciaole.com
127
+ email: jrg@vmware.com
128
128
  executables:
129
129
  - rbvmomish
130
130
  extensions: []
@@ -203,7 +203,8 @@ files:
203
203
  - rbvmomi.gemspec
204
204
  - vmodl.db
205
205
  homepage: https://github.com/vmware/rbvmomi
206
- licenses: []
206
+ licenses:
207
+ - MIT
207
208
  metadata: {}
208
209
  post_install_message:
209
210
  rdoc_options: []
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
222
  version: '0'
222
223
  requirements: []
223
224
  rubyforge_project:
224
- rubygems_version: 2.5.1
225
+ rubygems_version: 2.6.10
225
226
  signing_key:
226
227
  specification_version: 4
227
228
  summary: Ruby interface to the VMware vSphere API