rbvmomi 2.0.0 → 2.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3675fb1f195476fffb958df44a667c74b347277e5fa88416de07c33093286495
4
- data.tar.gz: 824a521c72865d6e8390cc8675b692d0f413d81426fb29882bb844ec97fbcb17
3
+ metadata.gz: ff1e2a42dc5de2b400dbc180315e922746090ee5feac055dc56d03db52ed861b
4
+ data.tar.gz: 957d2c4641b68cf99a0c493743ce344972093302e7939cb67d1fd7a7e70d25c6
5
5
  SHA512:
6
- metadata.gz: 06ec29d563c568e02b3b6740e45560c21ca0f5752f6815add6fc3a925f92aefa6ce51c16179acaf772b9d7f3aaca338f4c62fce84ee2444d790b997b591ab41c
7
- data.tar.gz: ee5baaeb14038b98e66ba57c4ef9c76a8e2fbbd83361feec5e93dcef6aef26fd4aa5d3cda77634c3d625a2c08d3fb89c38380060e21565460f9262e603d1d67e
6
+ metadata.gz: d586c72331490dafd93074737069b9b9526e1d4b986f0cd410ed51279897ed2d1ee046c589c393ece0db3e81cbece07d2be4f1c56004404b94db9c045bd31378
7
+ data.tar.gz: cdaecffc1a9fa2c4de85ebaf684bf5e1e51aac843e6c27cae9eaaefc15b36969c936cc76360ac4d27184efdaf528af67b1d9fb93a015e36f73df55a745e5bc3f
@@ -0,0 +1,155 @@
1
+ # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ require 'rbvmomi'
5
+
6
+ # Win32::SSPI is part of core on Windows
7
+ begin
8
+ require 'win32/sspi'
9
+ rescue LoadError
10
+ end
11
+ WIN32 = (defined? Win32::SSPI)
12
+
13
+ module RbVmomi
14
+
15
+ # A connection to one vSphere SDK endpoint.
16
+ # @see #serviceInstance
17
+ class VIM < Connection
18
+ # Connect to a vSphere SDK endpoint
19
+ #
20
+ # @param [Hash] opts The options hash.
21
+ # @option opts [String] :host Host to connect to.
22
+ # @option opts [Numeric] :port (443) Port to connect to.
23
+ # @option opts [Boolean] :ssl (true) Whether to use SSL.
24
+ # @option opts [Boolean] :insecure (false) If true, ignore SSL certificate errors.
25
+ # @option opts [String] :cookie If set, use cookie to connect instead of user/password
26
+ # @option opts [String] :user (root) Username.
27
+ # @option opts [String] :password Password.
28
+ # @option opts [String] :path (/sdk) SDK endpoint path.
29
+ # @option opts [Boolean] :debug (false) If true, print SOAP traffic to stderr.
30
+ # @option opts [String] :operation_id If set, use for operationID
31
+ def self.connect opts
32
+ fail unless opts.is_a? Hash
33
+ fail "host option required" unless opts[:host]
34
+ opts[:cookie] ||= nil
35
+ opts[:user] ||= (WIN32 ? ENV['USERNAME'].dup : 'root')
36
+ opts[:password] ||= ''
37
+ opts[:ssl] = true unless opts.member? :ssl or opts[:"no-ssl"]
38
+ opts[:insecure] ||= false
39
+ opts[:port] ||= (opts[:ssl] ? 443 : 80)
40
+ opts[:path] ||= '/sdk'
41
+ opts[:ns] ||= 'urn:vim25'
42
+ opts[:rev] = '6.5' if opts[:rev].nil?
43
+ opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug
44
+
45
+ conn = new(opts).tap do |vim|
46
+ unless opts[:cookie]
47
+ if WIN32 && opts[:password] == ''
48
+ # Attempt login by SSPI if no password specified on Windows
49
+ negotiation = Win32::SSPI::NegotiateAuth.new opts[:user], ENV['USERDOMAIN'].dup
50
+ begin
51
+ vim.serviceContent.sessionManager.LoginBySSPI :base64Token => negotiation.get_initial_token
52
+ rescue RbVmomi::Fault => fault
53
+ if !fault.fault.is_a?(RbVmomi::VIM::SSPIChallenge)
54
+ raise
55
+ else
56
+ vim.serviceContent.sessionManager.LoginBySSPI :base64Token => negotiation.complete_authentication(fault.base64Token)
57
+ end
58
+ end
59
+ else
60
+ vim.serviceContent.sessionManager.Login :userName => opts[:user], :password => opts[:password]
61
+ end
62
+ end
63
+ rev = vim.serviceContent.about.apiVersion
64
+ vim.rev = [rev, opts[:rev]].min { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }
65
+ end
66
+
67
+ at_exit { conn.close }
68
+ conn
69
+ end
70
+
71
+ def close
72
+ serviceContent.sessionManager.Logout
73
+ rescue RbVmomi::Fault => e
74
+ $stderr.puts(e.message) if debug
75
+ ensure
76
+ self.cookie = nil
77
+ super
78
+ end
79
+
80
+ def rev= x
81
+ super
82
+ @serviceContent = nil
83
+ end
84
+
85
+ # Return the ServiceInstance
86
+ #
87
+ # The ServiceInstance is the root of the vSphere inventory.
88
+ # @see http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.ServiceInstance.html
89
+ def serviceInstance
90
+ VIM::ServiceInstance self, 'ServiceInstance'
91
+ end
92
+
93
+ # Alias to serviceInstance.RetrieveServiceContent
94
+ def serviceContent
95
+ @serviceContent ||= serviceInstance.RetrieveServiceContent
96
+ end
97
+
98
+ # Alias to serviceContent.rootFolder
99
+ def rootFolder
100
+ serviceContent.rootFolder
101
+ end
102
+
103
+ alias root rootFolder
104
+
105
+ # Alias to serviceContent.propertyCollector
106
+ def propertyCollector
107
+ serviceContent.propertyCollector
108
+ end
109
+
110
+ # Alias to serviceContent.searchIndex
111
+ def searchIndex
112
+ serviceContent.searchIndex
113
+ end
114
+
115
+ # @private
116
+ def pretty_print pp
117
+ pp.text "VIM(#{@opts[:host]})"
118
+ end
119
+
120
+ def instanceUuid
121
+ serviceContent.about.instanceUuid
122
+ end
123
+
124
+ def get_log_lines logKey, lines=5, start=nil, host=nil
125
+ diagMgr = self.serviceContent.diagnosticManager
126
+ if !start
127
+ log = diagMgr.BrowseDiagnosticLog(:host => host, :key => logKey, :start => 999999999)
128
+ lineEnd = log.lineEnd
129
+ start = lineEnd - lines
130
+ end
131
+ start = start < 0 ? 0 : start
132
+ log = diagMgr.BrowseDiagnosticLog(:host => host, :key => logKey, :start => start)
133
+ if log.lineText.size > 0
134
+ [log.lineText.slice(-lines, log.lineText.size), log.lineEnd]
135
+ else
136
+ [log.lineText, log.lineEnd]
137
+ end
138
+ end
139
+
140
+ def get_log_keys host=nil
141
+ diagMgr = self.serviceContent.diagnosticManager
142
+ keys = []
143
+ diagMgr.QueryDescriptions(:host => host).each do |desc|
144
+ keys << "#{desc.key}"
145
+ end
146
+ keys
147
+ end
148
+
149
+ add_extension_dir File.join(File.dirname(__FILE__), "vim")
150
+ (ENV['RBVMOMI_VIM_EXTENSION_PATH']||'').split(':').each { |dir| add_extension_dir dir }
151
+
152
+ load_vmodl(ENV['VMODL'] || File.join(File.dirname(__FILE__), "../../vmodl.db"))
153
+ end
154
+
155
+ end
@@ -2,5 +2,5 @@
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
4
  module RbVmomi
5
- VERSION = '2.0.0'.freeze
5
+ VERSION = '2.0.1'.freeze
6
6
  end
@@ -0,0 +1,49 @@
1
+ require 'hashdiff'
2
+
3
+ module RbVmomi
4
+ # Utility class for VMware Managed Object Designed Language
5
+ #
6
+ # @author J.R. Garcia <jrg@vmware.com>
7
+ # @since 2.0.1
8
+ class VMODL
9
+ # Create a VMODL object from a marshaled file
10
+ #
11
+ # @author J.R. Garcia <jrg@vmware.com>
12
+ #
13
+ # @since 2.0.1
14
+ #
15
+ # @param [String] file the path to create the VMODL object from
16
+ #
17
+ # @return [VMODL] the created VMODL
18
+ def self.from_file(file = '')
19
+ raise ArgumentError, "'#{file}' doesn't exist" unless File.exist?(file)
20
+ new.tap { |o| o.instance_variable_set(:@file, file) }
21
+ end
22
+
23
+ # Translate a VMODL object to a Hash
24
+ #
25
+ # @author J.R. Garcia <jrg@vmware.com>
26
+ #
27
+ # @since 2.0.1
28
+ #
29
+ # @return [Hash] a Hash representation of the VMODL
30
+ def to_h
31
+ Marshal.load(IO.read(@file))
32
+ end
33
+
34
+ # Diff this VMODL with another VMODL
35
+ #
36
+ # @author J.R. Garcia <jrg@vmware.com>
37
+ #
38
+ # @since 2.0.1
39
+ #
40
+ # @return a diff of the VMODLs
41
+ def diff(other)
42
+ HashDiff.diff(self.to_h, other.to_h)
43
+ end
44
+
45
+ private
46
+
47
+ attr_accessor :file
48
+ end
49
+ end
data/vmodl.db CHANGED
Binary file
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: 2.0.0
4
+ version: 2.0.1
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: 2018-11-01 00:00:00.000000000 Z
12
+ date: 2019-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -130,40 +130,11 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - ".gitignore"
134
- - ".travis.yml"
135
- - ".yardopts"
136
- - CONTRIBUTORS.md
137
- - Gemfile
138
133
  - LICENSE
139
134
  - 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/delete_disk_from_vm.rb
153
- - examples/extraConfig.rb
154
- - examples/lease_tool.rb
155
- - examples/logbundle.rb
156
- - examples/logtail.rb
157
- - examples/nfs_datastore.rb
158
- - examples/power.rb
159
- - examples/readme-1.rb
160
- - examples/readme-2.rb
161
- - examples/run.sh
162
- - examples/screenshot.rb
163
- - examples/vdf.rb
164
- - examples/vm_drs_behavior.rb
165
135
  - exe/rbvmomish
166
136
  - lib/rbvmomi.rb
137
+ - lib/rbvmomi/#vim.rb#
167
138
  - lib/rbvmomi/basic_types.rb
168
139
  - lib/rbvmomi/connection.rb
169
140
  - lib/rbvmomi/deserialization.rb
@@ -201,7 +172,7 @@ files:
201
172
  - lib/rbvmomi/vim/ServiceInstance.rb
202
173
  - lib/rbvmomi/vim/Task.rb
203
174
  - lib/rbvmomi/vim/VirtualMachine.rb
204
- - rbvmomi.gemspec
175
+ - lib/rbvmomi/vmodl.rb
205
176
  - vmodl.db
206
177
  homepage: https://github.com/vmware/rbvmomi
207
178
  licenses:
@@ -222,8 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
193
  - !ruby/object:Gem::Version
223
194
  version: '0'
224
195
  requirements: []
225
- rubyforge_project:
226
- rubygems_version: 2.7.6
196
+ rubygems_version: 3.0.2
227
197
  signing_key:
228
198
  specification_version: 4
229
199
  summary: Ruby interface to the VMware vSphere API
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/
@@ -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
@@ -1,44 +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
- * Dave Hewitt <43970119+davehewitt@users.noreply.github.com>
10
- * Dominic Cleal <dcleal@redhat.com>
11
- * Dominic Cleal <dominic@cleal.org>
12
- * Doug MacEachern <dougm@vmware.com>
13
- * E Arvidson <earvidso@users.noreply.github.com>
14
- * Erik Peterson <erik@subwindow.com>
15
- * Fabio Rapposelli <fabio@rapposelli.org>
16
- * Giuliano <giuliano@108.bz>
17
- * Guido Günther <agx@sigxcpu.org>
18
- * Hari Krishnamurthy <hkrishna@vmware.com>
19
- * J.R. Garcia <jr@garciaole.com>
20
- * Jacob Evans <jacob@dekz.net>
21
- * Justin <justin@labs.epiuse.com>
22
- * Kevin Menard <nirvdrum@gmail.com>
23
- * Lalitha Sripada <lsripada@vmware.com>
24
- * Martin Englund <martin@englund.nu>
25
- * Nan Liu <nan.liu@gmail.com>
26
- * Omar Baba <obaba@infinio.com>
27
- * Peter <peter.adkins@kernelpicnic.net>
28
- * Puneet Katyal <pkatyal@vmware.com>
29
- * Randy Robertson <rmrobert@vmware.com>
30
- * Rich Lane <lanerl@gmail.com>
31
- * Rich Lane <rlane@club.cc.cmu.edu>
32
- * Rich Lane <rlane@vmware.com>
33
- * Scott J. Goldman <scottjg@vmware.com>
34
- * Shawn Hartsock <hartsock@users.noreply.github.com>
35
- * Shawn Hartsock <hartsocks@vmware.com>
36
- * Shawn Hartsock <shawn.hartsock@gmail.com>
37
- * Soner Sevinc <sevincs@vmware.com>
38
- * Tom Bortels <bortels@gmail.com>
39
- * Tu Hoang <rebyn@me.com>
40
- * administrator <administrator@cdickmann-mbpro.gateway.2wire.net>
41
- * cdickmann <christian.dickmann@gmail.com>
42
- * howels <howels@users.noreply.github.com>
43
- * kumabuchi.kenji <k.kumabuchi+github@gmail.com>
44
- * 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
@@ -1,217 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
4
- # SPDX-License-Identifier: MIT
5
-
6
- require 'nokogiri'
7
- require 'pp'
8
- # :usage => analyze-vim-declarations.rb vim-declarations.xml foo-declarations.xml vmodl.db
9
-
10
- XML_FNS = ARGV[0...-1]
11
- abort "must specify path to vim-declarations.xml" if XML_FNS.empty?
12
- OUT_FN = ARGV[-1] or abort "must specify path to output database"
13
-
14
- XML_FNS.each do |x|
15
- abort "XML file #{x} does not exist" unless File.exists? x
16
- end
17
-
18
- TYPES = {}
19
- VERSIONS = []
20
-
21
- ID2NAME = Hash.new { |h,k| fail "unknown type-id #{k.inspect}" }
22
-
23
- ID2NAME.merge!({
24
- 'java.lang.String' => 'xsd:string',
25
- 'BOOLEAN' => 'xsd:boolean',
26
- 'BYTE' => 'xsd:byte',
27
- 'SHORT' => 'xsd:short',
28
- 'INT' => 'xsd:int',
29
- 'LONG' => 'xsd:long',
30
- 'FLOAT' => 'xsd:float',
31
- 'DOUBLE' => 'xsd:double',
32
- 'vmodl.DateTime' => 'xsd:dateTime',
33
- 'vmodl.Binary' => 'xsd:base64Binary',
34
- 'vmodl.Any' => 'xsd:anyType',
35
- 'vmodl.URI' => 'xsd:anyURI',
36
- 'void' => nil,
37
- })
38
-
39
- %w(DataObject ManagedObject MethodFault MethodName
40
- PropertyPath RuntimeFault TypeName).each do |x|
41
- ID2NAME['vmodl.' + x] = x
42
- end
43
-
44
- def handle_data_object node
45
- if TYPES[node['name']]
46
- puts "Type #{node['name']} already exists"
47
- return
48
- end
49
-
50
- ID2NAME[node['type-id']] = node['name']
51
- TYPES[node['name']] = {
52
- 'kind' => 'data',
53
- 'base-type-id' => node['base-type-id'],
54
- 'props' => node.children.select { |x| x.name == 'property' }.map do |property|
55
- {
56
- 'name' => property['name'],
57
- 'type-id-ref' => property['type-id-ref'],
58
- 'is-optional' => property['is-optional'] ? true : false,
59
- 'is-array' => property['is-array'] ? true : false,
60
- 'version-id-ref' => property['version-id-ref'],
61
- }
62
- end
63
- }
64
- end
65
-
66
- def handle_managed_object node
67
- if TYPES[node['name']]
68
- puts "Type #{node['name']} already exists"
69
- return
70
- end
71
- ID2NAME[node['type-id']] = node['name']
72
- TYPES[node['name']] = {
73
- 'kind' => 'managed',
74
- 'base-type-id' => node['base-type-id'],
75
- 'props' => node.children.select { |x| x.name == 'property' }.map do |property|
76
- {
77
- 'name' => property['name'],
78
- 'type-id-ref' => property['type-id-ref'],
79
- 'is-optional' => property['is-optional'] ? true : false,
80
- 'is-array' => property['is-array'] ? true : false,
81
- 'version-id-ref' => property['version-id-ref'],
82
- }
83
- end,
84
- 'methods' => Hash[
85
- node.children.select { |x| x.name == 'method' }.map do |method|
86
- [method['is-task'] ? "#{method['name']}_Task" : method['name'],
87
- {
88
- 'params' => method.children.select { |x| x.name == 'parameter' }.map do |param|
89
- {
90
- 'name' => param['name'],
91
- 'type-id-ref' => param['type-id-ref'],
92
- 'is-array' => param['is-array'] ? true : false,
93
- 'is-optional' => param['is-optional'] ? true : false,
94
- 'version-id-ref' => param['version-id-ref'],
95
- }
96
- end,
97
- 'result' => {
98
- 'type-id-ref' => method['type-id-ref'],
99
- 'is-array' => method['is-array'] ? true : false,
100
- 'is-optional' => method['is-optional'] ? true : false,
101
- 'is-task' => method['is-task'] ? true : false,
102
- 'version-id-ref' => method['version-id-ref'],
103
- }
104
- }
105
- ]
106
- end
107
- ]
108
- }
109
- end
110
-
111
- def handle_enum node
112
- if TYPES[node['name']]
113
- puts "Type #{node['name']} already exists"
114
- return
115
- end
116
-
117
- ID2NAME[node['type-id']] = node['name']
118
- TYPES[node['name']] = {
119
- 'kind' => 'enum',
120
- 'values' => node.children.map { |child| child['name'] },
121
- }
122
- end
123
-
124
- def handle_fault node
125
- handle_data_object node
126
- end
127
-
128
- def handle_version x
129
- attrs = %w(display-name name service-namespace type-id version-id vmodl-name)
130
- h = Hash[attrs.map { |k| [k, x[k]] }]
131
- h['compatible'] = x.children.select(&:element?).map { |y| y.text }
132
- VERSIONS << h
133
- end
134
-
135
- XML_FNS.each do |fn|
136
- puts "parsing #{fn} ..."
137
- xml_str = File.read(fn)
138
- xml_str = xml_str.gsub(/\<description-html\>(.*?)\<\/description-html\>/m, "")
139
- xml = Nokogiri.parse(xml_str, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS)
140
- xml.root.at('enums').children.each { |x| handle_enum x }
141
- xml.root.at('managed-objects').children.each { |x| handle_managed_object x }
142
- xml.root.at('data-objects').children.each { |x| handle_data_object x }
143
- xml.root.at('faults').children.each { |x| handle_fault x }
144
- #xml.root.at('definitions').at('version-types').children.each { |x| handle_version x }
145
- end
146
-
147
- #pp ID2NAME
148
-
149
- munge_fault = lambda { |x| true }
150
-
151
- TYPES.each do |k,t|
152
- case t['kind']
153
- when 'data'
154
- t['wsdl_base'] = t['base-type-id'] ? ID2NAME[t['base-type-id']] : 'DataObject'
155
- t.delete 'base-type-id'
156
- t['props'].each do |x|
157
- x['wsdl_type'] = ID2NAME[x['type-id-ref']]
158
- x.delete 'type-id-ref'
159
- munge_fault[x]
160
- end
161
- when 'managed'
162
- t['wsdl_base'] = t['base-type-id'] ? ID2NAME[t['base-type-id']] : 'ManagedObject'
163
- t.delete 'base-type-id'
164
- t['props'].each do |x|
165
- x['wsdl_type'] = ID2NAME[x['type-id-ref']]
166
- x.delete 'type-id-ref'
167
- munge_fault[x]
168
- end
169
- t['methods'].each do |mName,x|
170
- if y = x['result']
171
- begin
172
- y['wsdl_type'] = ID2NAME[y['type-id-ref']]
173
- rescue Exception => ex
174
- pp ex
175
- end
176
- y.delete 'type-id-ref'
177
- munge_fault[y]
178
- end
179
- x['params'].each do |r|
180
- begin
181
- r['wsdl_type'] = ID2NAME[r['type-id-ref']]
182
- rescue Exception => ex
183
- pp ex
184
- end
185
- r.delete 'type-id-ref'
186
- munge_fault[r]
187
- end
188
- end
189
- when 'enum'
190
- else fail
191
- end
192
- end
193
-
194
- db = {}
195
-
196
- TYPES.each do |k,t|
197
- db[k] = t
198
- end
199
-
200
- db['_typenames'] = TYPES.keys
201
- db['_versions'] = VERSIONS
202
-
203
- File.open(OUT_FN, 'w') { |io| Marshal.dump db, io }
204
-
205
- if filename = ENV['VERSION_GRAPH']
206
- File.open(filename, 'w') do |io|
207
- io.puts "digraph versions\n{"
208
- VERSIONS.each do |h|
209
- io.puts "\"#{h['vmodl-name']}\" [label=\"#{h['vmodl-name']} (#{h['version-id']})\"]"
210
- h['compatible'].each do |x|
211
- x =~ /^interface / or fail x
212
- io.puts "\"#{h['vmodl-name']}\" -> \"#{$'}\""
213
- end
214
- end
215
- io.puts "}\n"
216
- end
217
- end