rbvmomi 1.11.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -2
  3. data/exe/rbvmomish +5 -5
  4. data/lib/rbvmomi/connection.rb +13 -13
  5. data/lib/rbvmomi/deserialization.rb +1 -2
  6. data/lib/rbvmomi/{trollop.rb → optimist.rb} +7 -7
  7. data/lib/rbvmomi/pbm.rb +1 -1
  8. data/lib/rbvmomi/sms.rb +1 -1
  9. data/lib/rbvmomi/sso.rb +313 -0
  10. data/lib/rbvmomi/trivial_soap.rb +8 -5
  11. data/lib/rbvmomi/type_loader.rb +1 -1
  12. data/lib/rbvmomi/utils/deploy.rb +1 -1
  13. data/lib/rbvmomi/version.rb +2 -2
  14. data/lib/rbvmomi/vim/Folder.rb +1 -1
  15. data/lib/rbvmomi/vim/HostSystem.rb +2 -2
  16. data/lib/rbvmomi/vim/ManagedObject.rb +1 -1
  17. data/lib/rbvmomi/vim/OvfManager.rb +1 -1
  18. data/lib/rbvmomi/vim/VirtualMachine.rb +9 -11
  19. data/lib/rbvmomi/vim.rb +9 -10
  20. data/lib/rbvmomi.rb +11 -9
  21. data/vmodl.db +0 -0
  22. metadata +45 -61
  23. data/.gitignore +0 -13
  24. data/.travis.yml +0 -11
  25. data/.yardopts +0 -6
  26. data/CONTRIBUTORS.md +0 -42
  27. data/Gemfile +0 -10
  28. data/Rakefile +0 -16
  29. data/devel/analyze-vim-declarations.rb +0 -217
  30. data/devel/analyze-xml.rb +0 -49
  31. data/devel/benchmark.rb +0 -121
  32. data/devel/collisions.rb +0 -22
  33. data/devel/merge-internal-vmodl.rb +0 -63
  34. data/devel/merge-manual-vmodl.rb +0 -36
  35. data/examples/annotate.rb +0 -57
  36. data/examples/cached_ovf_deploy.rb +0 -124
  37. data/examples/clone_vm.rb +0 -88
  38. data/examples/create_vm-1.9.rb +0 -97
  39. data/examples/create_vm.rb +0 -97
  40. data/examples/extraConfig.rb +0 -57
  41. data/examples/lease_tool.rb +0 -106
  42. data/examples/logbundle.rb +0 -66
  43. data/examples/logtail.rb +0 -63
  44. data/examples/nfs_datastore.rb +0 -99
  45. data/examples/power.rb +0 -62
  46. data/examples/readme-1.rb +0 -38
  47. data/examples/readme-2.rb +0 -54
  48. data/examples/run.sh +0 -41
  49. data/examples/screenshot.rb +0 -51
  50. data/examples/vdf.rb +0 -84
  51. data/examples/vm_drs_behavior.rb +0 -80
  52. data/rbvmomi.gemspec +0 -33
@@ -13,38 +13,36 @@ class RbVmomi::VIM::VirtualMachine
13
13
  def disks
14
14
  self.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
15
15
  end
16
-
17
- # Get the IP of the guest, but only if it is not stale
16
+
17
+ # Get the IP of the guest, but only if it is not stale
18
18
  # @return [String] Current IP reported (as per VMware Tools) or nil
19
- def guest_ip
19
+ def guest_ip
20
20
  g = self.guest
21
21
  if g.ipAddress && (g.toolsStatus == "toolsOk" || g.toolsStatus == "toolsOld")
22
22
  g.ipAddress
23
23
  else
24
24
  nil
25
25
  end
26
- end
26
+ end
27
27
 
28
28
  # Add a layer of delta disks (redo logs) in front of every disk on the VM.
29
29
  # This is similar to taking a snapshot and makes the VM a valid target for
30
30
  # creating a linked clone.
31
31
  #
32
- # Background: The API for linked clones is quite strange. We can't create
32
+ # Background: The API for linked clones is quite strange. We can't create
33
33
  # a linked straight from any VM. The disks of the VM for which we can create a
34
34
  # linked clone need to be read-only and thus VC demands that the VM we
35
35
  # are cloning from uses delta-disks. Only then it will allow us to
36
36
  # share the base disk.
37
37
  def add_delta_disk_layer_on_all_disks
38
- devices, = self.collect 'config.hardware.device'
39
- disks = devices.grep(RbVmomi::VIM::VirtualDisk)
40
38
  spec = update_spec_add_delta_disk_layer_on_all_disks
41
39
  self.ReconfigVM_Task(:spec => spec).wait_for_completion
42
40
  end
43
-
41
+
44
42
  # Updates a passed in spec to perform the task of adding a delta disk layer
45
43
  # on top of all disks. Does the same as add_delta_disk_layer_on_all_disks
46
- # but instead of issuing the ReconfigVM_Task, it just constructs the
47
- # spec, so that the caller can batch a couple of updates into one
44
+ # but instead of issuing the ReconfigVM_Task, it just constructs the
45
+ # spec, so that the caller can batch a couple of updates into one
48
46
  # ReconfigVM_Task.
49
47
  def update_spec_add_delta_disk_layer_on_all_disks spec = {}
50
48
  devices, = self.collect 'config.hardware.device'
@@ -73,5 +71,5 @@ class RbVmomi::VIM::VirtualMachine
73
71
  spec[:deviceChange] += device_change
74
72
  end
75
73
  spec
76
- end
74
+ end
77
75
  end
data/lib/rbvmomi/vim.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
- require 'rbvmomi'
5
-
6
4
  # Win32::SSPI is part of core on Windows
7
5
  begin
8
6
  require 'win32/sspi'
@@ -28,6 +26,8 @@ class VIM < Connection
28
26
  # @option opts [String] :path (/sdk) SDK endpoint path.
29
27
  # @option opts [Boolean] :debug (false) If true, print SOAP traffic to stderr.
30
28
  # @option opts [String] :operation_id If set, use for operationID
29
+ # @option opts [Boolean] :close_on_exit (true) If true, will close connection with at_exit
30
+ # @option opts [RbVmomi::SSO] :sso (nil) Use SSO token to login if set
31
31
  def self.connect opts
32
32
  fail unless opts.is_a? Hash
33
33
  fail "host option required" unless opts[:host]
@@ -39,8 +39,7 @@ class VIM < Connection
39
39
  opts[:port] ||= (opts[:ssl] ? 443 : 80)
40
40
  opts[:path] ||= '/sdk'
41
41
  opts[:ns] ||= 'urn:vim25'
42
- rev_given = opts[:rev] != nil
43
- opts[:rev] = '6.5' unless rev_given
42
+ opts[:rev] = '6.7' if opts[:rev].nil?
44
43
  opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug
45
44
 
46
45
  conn = new(opts).tap do |vim|
@@ -57,17 +56,17 @@ class VIM < Connection
57
56
  vim.serviceContent.sessionManager.LoginBySSPI :base64Token => negotiation.complete_authentication(fault.base64Token)
58
57
  end
59
58
  end
59
+ elsif opts[:sso]
60
+ vim.serviceContent.sessionManager.LoginByToken
60
61
  else
61
- vim.serviceContent.sessionManager.Login :userName => opts[:user], :password => opts[:password]
62
+ vim.serviceContent.sessionManager.Login :userName => opts[:user], :password => opts[:password]
62
63
  end
63
64
  end
64
- unless rev_given
65
- rev = vim.serviceContent.about.apiVersion
66
- vim.rev = [rev, '6.5'].min
67
- end
65
+ rev = vim.serviceContent.about.apiVersion
66
+ vim.rev = [rev, opts[:rev]].min { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
68
67
  end
69
68
 
70
- at_exit { conn.close }
69
+ at_exit { conn.close } if opts.fetch(:close_on_exit, true)
71
70
  conn
72
71
  end
73
72
 
data/lib/rbvmomi.rb CHANGED
@@ -1,14 +1,16 @@
1
- # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
1
+ # Copyright (c) 2010-2019 VMware, Inc. All Rights Reserved.
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
+ # RbVmomi is a Ruby interface to the vSphere management interface
4
5
  module RbVmomi
5
-
6
- # @private
7
- # @deprecated Use +RbVmomi::VIM.connect+.
8
- def self.connect opts
9
- VIM.connect opts
6
+ # @private
7
+ # @deprecated Use +RbVmomi::VIM.connect+.
8
+ def self.connect(opts)
9
+ VIM.connect opts
10
+ end
10
11
  end
11
12
 
12
- end
13
- require 'rbvmomi/connection'
14
- require 'rbvmomi/vim'
13
+ require_relative 'rbvmomi/connection'
14
+ require_relative 'rbvmomi/sso'
15
+ require_relative 'rbvmomi/version'
16
+ require_relative 'rbvmomi/vim'
data/vmodl.db CHANGED
Binary file
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbvmomi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich Lane
8
8
  - Christian Dickmann
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-06-27 00:00:00.000000000 Z
12
+ date: 2020-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -17,161 +17,147 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '3.0'
20
+ version: '3.2'
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.0'
27
+ version: '3.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.8'
34
+ version: '2.3'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.8'
41
+ version: '2.3'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: nokogiri
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.5'
48
+ version: '1.10'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '1.5'
55
+ version: '1.10'
56
56
  - !ruby/object:Gem::Dependency
57
- name: trollop
57
+ name: optimist
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.1'
62
+ version: '3.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.1'
69
+ version: '3.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: pry
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: 0.13.1
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 0.13.1
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rake
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
88
  - - "~>"
75
89
  - !ruby/object:Gem::Version
76
- version: '10.5'
90
+ version: '13.0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
95
  - - "~>"
82
96
  - !ruby/object:Gem::Version
83
- version: '10.5'
97
+ version: '13.0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: simplecov
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: 0.12.0
104
+ version: 0.18.5
91
105
  type: :development
92
106
  prerelease: false
93
107
  version_requirements: !ruby/object:Gem::Requirement
94
108
  requirements:
95
109
  - - "~>"
96
110
  - !ruby/object:Gem::Version
97
- version: 0.12.0
111
+ version: 0.18.5
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: yard
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
116
  - - "~>"
103
117
  - !ruby/object:Gem::Version
104
- version: 0.9.5
118
+ version: 0.9.25
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
108
122
  requirements:
109
123
  - - "~>"
110
124
  - !ruby/object:Gem::Version
111
- version: 0.9.5
125
+ version: 0.9.25
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: test-unit
114
128
  requirement: !ruby/object:Gem::Requirement
115
129
  requirements:
116
- - - ">="
130
+ - - "~>"
117
131
  - !ruby/object:Gem::Version
118
- version: '2.5'
132
+ version: '3.3'
119
133
  type: :development
120
134
  prerelease: false
121
135
  version_requirements: !ruby/object:Gem::Requirement
122
136
  requirements:
123
- - - ">="
137
+ - - "~>"
124
138
  - !ruby/object:Gem::Version
125
- version: '2.5'
126
- description:
139
+ version: '3.3'
140
+ description:
127
141
  email: jrg@vmware.com
128
142
  executables:
129
143
  - rbvmomish
130
144
  extensions: []
131
145
  extra_rdoc_files: []
132
146
  files:
133
- - ".gitignore"
134
- - ".travis.yml"
135
- - ".yardopts"
136
- - CONTRIBUTORS.md
137
- - Gemfile
138
147
  - LICENSE
139
148
  - README.md
140
- - Rakefile
141
- - devel/analyze-vim-declarations.rb
142
- - devel/analyze-xml.rb
143
- - devel/benchmark.rb
144
- - devel/collisions.rb
145
- - devel/merge-internal-vmodl.rb
146
- - devel/merge-manual-vmodl.rb
147
- - examples/annotate.rb
148
- - examples/cached_ovf_deploy.rb
149
- - examples/clone_vm.rb
150
- - examples/create_vm-1.9.rb
151
- - examples/create_vm.rb
152
- - examples/extraConfig.rb
153
- - examples/lease_tool.rb
154
- - examples/logbundle.rb
155
- - examples/logtail.rb
156
- - examples/nfs_datastore.rb
157
- - examples/power.rb
158
- - examples/readme-1.rb
159
- - examples/readme-2.rb
160
- - examples/run.sh
161
- - examples/screenshot.rb
162
- - examples/vdf.rb
163
- - examples/vm_drs_behavior.rb
164
149
  - exe/rbvmomish
165
150
  - lib/rbvmomi.rb
166
151
  - lib/rbvmomi/basic_types.rb
167
152
  - lib/rbvmomi/connection.rb
168
153
  - lib/rbvmomi/deserialization.rb
169
154
  - lib/rbvmomi/fault.rb
155
+ - lib/rbvmomi/optimist.rb
170
156
  - lib/rbvmomi/pbm.rb
171
157
  - lib/rbvmomi/sms.rb
172
158
  - lib/rbvmomi/sms/SmsStorageManager.rb
159
+ - lib/rbvmomi/sso.rb
173
160
  - lib/rbvmomi/trivial_soap.rb
174
- - lib/rbvmomi/trollop.rb
175
161
  - lib/rbvmomi/type_loader.rb
176
162
  - lib/rbvmomi/utils/admission_control.rb
177
163
  - lib/rbvmomi/utils/deploy.rb
@@ -200,13 +186,12 @@ files:
200
186
  - lib/rbvmomi/vim/ServiceInstance.rb
201
187
  - lib/rbvmomi/vim/Task.rb
202
188
  - lib/rbvmomi/vim/VirtualMachine.rb
203
- - rbvmomi.gemspec
204
189
  - vmodl.db
205
190
  homepage: https://github.com/vmware/rbvmomi
206
191
  licenses:
207
192
  - MIT
208
193
  metadata: {}
209
- post_install_message:
194
+ post_install_message:
210
195
  rdoc_options: []
211
196
  require_paths:
212
197
  - lib
@@ -214,16 +199,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
199
  requirements:
215
200
  - - ">="
216
201
  - !ruby/object:Gem::Version
217
- version: 1.8.7
202
+ version: 2.4.1
218
203
  required_rubygems_version: !ruby/object:Gem::Requirement
219
204
  requirements:
220
205
  - - ">="
221
206
  - !ruby/object:Gem::Version
222
207
  version: '0'
223
208
  requirements: []
224
- rubyforge_project:
225
- rubygems_version: 2.6.12
226
- signing_key:
209
+ rubygems_version: 3.1.2
210
+ signing_key:
227
211
  specification_version: 4
228
212
  summary: Ruby interface to the VMware vSphere API
229
213
  test_files: []
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- *.rbc
2
- *.swp
3
- *.swo
4
- .ruby-version
5
- .ruby-gemset
6
- Gemfile.lock
7
- /.bundle/
8
- /.yardoc/
9
- /coverage/
10
- /doc/
11
- /pkg/
12
- /vendor/bundle/
13
- /vmodl/
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.8.7
4
- - 1.9.3
5
- - 2.2.6
6
- - 2.3.3
7
- - 2.4.0
8
- - jruby-1.7.26
9
- - jruby-9.1.8.0
10
- before_install:
11
- - gem install bundler
data/.yardopts DELETED
@@ -1,6 +0,0 @@
1
- --title "RbVmomi - a Ruby interface to the vSphere API"
2
- --no-private
3
- --readme README.md
4
- lib/rbvmomi/vim.rb
5
- lib/rbvmomi/vim/*.rb
6
- lib/rbvmomi/trollop.rb
data/CONTRIBUTORS.md DELETED
@@ -1,42 +0,0 @@
1
- * Adam Grare <agrare@redhat.com>
2
- * Anurag Uniyal <auniyal@vmware.com>
3
- * Benjamin Bytheway <ben.bytheway@imail.org>
4
- * Christian Dickmann <cdickmann@ubuntu.(none)>
5
- * Christian Dickmann <cdickmann@vmware.com>
6
- * Colin O'Byrne and Martin Marinov <cobyrne@vmware.com>
7
- * Colin O'Byrne and Nick Coelius <cobyrne@vmware.com>
8
- * Daniel Rife <daniel.rife@rightscale.com>
9
- * Dominic Cleal <dcleal@redhat.com>
10
- * Dominic Cleal <dominic@cleal.org>
11
- * Doug MacEachern <dougm@vmware.com>
12
- * E Arvidson <earvidso@users.noreply.github.com>
13
- * Erik Peterson <erik@subwindow.com>
14
- * Fabio Rapposelli <fabio@rapposelli.org>
15
- * Giuliano <giuliano@108.bz>
16
- * Guido Günther <agx@sigxcpu.org>
17
- * Hari Krishnamurthy <hkrishna@vmware.com>
18
- * J.R. Garcia <jr@garciaole.com>
19
- * Jacob Evans <jacob@dekz.net>
20
- * Justin <justin@labs.epiuse.com>
21
- * Kevin Menard <nirvdrum@gmail.com>
22
- * Lalitha Sripada <lsripada@vmware.com>
23
- * Martin Englund <martin@englund.nu>
24
- * Nan Liu <nan.liu@gmail.com>
25
- * Omar Baba <obaba@infinio.com>
26
- * Puneet Katyal <pkatyal@vmware.com>
27
- * Randy Robertson <rmrobert@vmware.com>
28
- * Rich Lane <lanerl@gmail.com>
29
- * Rich Lane <rlane@club.cc.cmu.edu>
30
- * Rich Lane <rlane@vmware.com>
31
- * Scott J. Goldman <scottjg@vmware.com>
32
- * Shawn Hartsock <hartsock@users.noreply.github.com>
33
- * Shawn Hartsock <hartsocks@vmware.com>
34
- * Shawn Hartsock <shawn.hartsock@gmail.com>
35
- * Soner Sevinc <sevincs@vmware.com>
36
- * Tom Bortels <bortels@gmail.com>
37
- * Tu Hoang <rebyn@me.com>
38
- * administrator <administrator@cdickmann-mbpro.gateway.2wire.net>
39
- * cdickmann <christian.dickmann@gmail.com>
40
- * howels <howels@users.noreply.github.com>
41
- * kumabuchi.kenji <k.kumabuchi+github@gmail.com>
42
- * thanhngn <thanhngn@users.noreply.github.com>
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- # Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
2
- # SPDX-License-Identifier: MIT
3
-
4
- source 'https://rubygems.org'
5
-
6
- gemspec
7
-
8
- gem 'json', '< 2' if RUBY_VERSION.start_with?('1.')
9
- gem 'nokogiri', '< 1.6' if RUBY_VERSION.start_with?('1.8.')
10
- gem 'test-unit', '~> 2.5' if RUBY_VERSION.start_with?('1.8.')
data/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
- # SPDX-License-Identifier: MIT
3
-
4
- require 'bundler/gem_tasks'
5
- require 'rake/testtask'
6
- require 'yard'
7
-
8
- task(:default => :test)
9
-
10
- Rake::TestTask.new do |t|
11
- t.libs << "test"
12
- t.test_files = FileList['test/test_*.rb']
13
- t.verbose = true
14
- end
15
-
16
- YARD::Rake::YardocTask.new