rbvmomi2 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -25
  3. data/exe/rbvmomish +50 -48
  4. data/lib/rbvmomi/basic_types.rb +318 -294
  5. data/lib/rbvmomi/connection.rb +221 -216
  6. data/lib/rbvmomi/deserialization.rb +201 -205
  7. data/lib/rbvmomi/fault.rb +10 -9
  8. data/lib/rbvmomi/optimist.rb +51 -50
  9. data/lib/rbvmomi/pbm.rb +52 -50
  10. data/lib/rbvmomi/sms/SmsStorageManager.rb +2 -1
  11. data/lib/rbvmomi/sms.rb +48 -46
  12. data/lib/rbvmomi/sso.rb +13 -18
  13. data/lib/rbvmomi/trivial_soap.rb +9 -8
  14. data/lib/rbvmomi/type_loader.rb +100 -101
  15. data/lib/rbvmomi/utils/admission_control.rb +90 -106
  16. data/lib/rbvmomi/utils/deploy.rb +77 -85
  17. data/lib/rbvmomi/utils/leases.rb +31 -33
  18. data/lib/rbvmomi/utils/perfdump.rb +177 -207
  19. data/lib/rbvmomi/version.rb +2 -1
  20. data/lib/rbvmomi/vim/ComputeResource.rb +17 -15
  21. data/lib/rbvmomi/vim/Datacenter.rb +1 -0
  22. data/lib/rbvmomi/vim/Datastore.rb +18 -15
  23. data/lib/rbvmomi/vim/DynamicTypeMgrAllTypeInfo.rb +7 -6
  24. data/lib/rbvmomi/vim/DynamicTypeMgrDataTypeInfo.rb +3 -2
  25. data/lib/rbvmomi/vim/DynamicTypeMgrManagedTypeInfo.rb +7 -6
  26. data/lib/rbvmomi/vim/Folder.rb +37 -33
  27. data/lib/rbvmomi/vim/HostSystem.rb +139 -136
  28. data/lib/rbvmomi/vim/ManagedEntity.rb +15 -14
  29. data/lib/rbvmomi/vim/ManagedObject.rb +11 -10
  30. data/lib/rbvmomi/vim/ObjectContent.rb +3 -1
  31. data/lib/rbvmomi/vim/ObjectUpdate.rb +3 -1
  32. data/lib/rbvmomi/vim/OvfManager.rb +50 -57
  33. data/lib/rbvmomi/vim/PerfCounterInfo.rb +4 -3
  34. data/lib/rbvmomi/vim/PerformanceManager.rb +28 -31
  35. data/lib/rbvmomi/vim/PropertyCollector.rb +8 -7
  36. data/lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb +22 -21
  37. data/lib/rbvmomi/vim/ResourcePool.rb +19 -18
  38. data/lib/rbvmomi/vim/ServiceInstance.rb +8 -7
  39. data/lib/rbvmomi/vim/Task.rb +6 -5
  40. data/lib/rbvmomi/vim/VirtualMachine.rb +8 -7
  41. data/lib/rbvmomi/vim.rb +112 -129
  42. data/lib/rbvmomi.rb +1 -0
  43. metadata +54 -10
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
3
  # SPDX-License-Identifier: MIT
3
4
 
@@ -5,245 +6,240 @@ require 'time'
5
6
 
6
7
  module RbVmomi
7
8
 
8
- class NewDeserializer
9
- NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance'
9
+ class NewDeserializer
10
+ NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance'
10
11
 
11
- DEMANGLED_ARRAY_TYPES = {
12
- 'AnyType' => 'xsd:anyType',
13
- 'DateTime' => 'xsd:dateTime',
14
- }
15
- %w(Boolean String Byte Short Int Long Float Double).each do |x|
16
- DEMANGLED_ARRAY_TYPES[x] = "xsd:#{x.downcase}"
17
- end
18
-
19
- BUILTIN_TYPE_ACTIONS = {
20
- 'xsd:string' => :string,
21
- 'xsd:boolean' => :boolean,
22
- 'xsd:byte' => :int,
23
- 'xsd:short' => :int,
24
- 'xsd:int' => :int,
25
- 'xsd:long' => :int,
26
- 'xsd:float' => :float,
27
- 'xsd:dateTime' => :date,
28
- 'PropertyPath' => :string,
29
- 'MethodName' => :string,
30
- 'TypeName' => :string,
31
- 'xsd:base64Binary' => :binary,
32
- 'KeyValue' => :keyvalue,
33
- }
34
-
35
- BUILTIN_TYPE_ACTIONS.dup.each do |k,v|
36
- if k =~ /^xsd:/
37
- BUILTIN_TYPE_ACTIONS[$'] = v
12
+ DEMANGLED_ARRAY_TYPES = {
13
+ 'AnyType' => 'xsd:anyType',
14
+ 'DateTime' => 'xsd:dateTime',
15
+ }
16
+ %w(Boolean String Byte Short Int Long Float Double).each do |x|
17
+ DEMANGLED_ARRAY_TYPES[x] = "xsd:#{x.downcase}"
38
18
  end
39
- end
40
-
41
- def initialize conn
42
- @conn = conn
43
- @loader = conn.class.loader
44
- end
45
-
46
- def deserialize node, type=nil
47
- type_attr = node['type']
48
19
 
49
- # Work around for 1.5.x which doesn't populate node['type']
50
- # XXX what changed
51
- if node.attributes['type'] and not type_attr
52
- type_attr = node.attributes['type'].value
20
+ BUILTIN_TYPE_ACTIONS = {
21
+ 'xsd:string' => :string,
22
+ 'xsd:boolean' => :boolean,
23
+ 'xsd:byte' => :int,
24
+ 'xsd:short' => :int,
25
+ 'xsd:int' => :int,
26
+ 'xsd:long' => :int,
27
+ 'xsd:float' => :float,
28
+ 'xsd:dateTime' => :date,
29
+ 'PropertyPath' => :string,
30
+ 'MethodName' => :string,
31
+ 'TypeName' => :string,
32
+ 'xsd:base64Binary' => :binary,
33
+ 'KeyValue' => :keyvalue,
34
+ }
35
+
36
+ BUILTIN_TYPE_ACTIONS.dup.each do |k, v|
37
+ BUILTIN_TYPE_ACTIONS[$'] = v if k =~ /^xsd:/
53
38
  end
54
39
 
55
- type = type_attr if type_attr
56
-
57
- if action = BUILTIN_TYPE_ACTIONS[type]
58
- case action
59
- when :string
60
- node.content
61
- when :boolean
62
- node.content == '1' || node.content == 'true'
63
- when :int
64
- node.content.to_i
65
- when :float
66
- node.content.to_f
67
- when :date
68
- leaf_date node
69
- when :binary
70
- leaf_binary node
71
- when :keyvalue
72
- leaf_keyvalue node
73
- else fail
74
- end
75
- else
76
- if type =~ /:/
77
- type = type.split(":", 2)[1]
78
- end
79
- if type =~ /^ArrayOf/
80
- type = DEMANGLED_ARRAY_TYPES[$'] || $'
81
- return node.children.select(&:element?).map { |c| deserialize c, type }
82
- end
83
- if type =~ /:/
84
- type = type.split(":", 2)[1]
85
- end
40
+ def initialize conn
41
+ @conn = conn
42
+ @loader = conn.class.loader
43
+ end
86
44
 
87
- klass = @loader.get(type) or fail "no such type '#{type}'"
88
- case klass.kind
89
- when :data
90
- traverse_data node, klass
91
- when :enum
92
- node.content
93
- when :managed
94
- leaf_managed node, klass
95
- else fail
45
+ def deserialize node, type=nil
46
+ type_attr = node['type']
47
+
48
+ # Work around for 1.5.x which doesn't populate node['type']
49
+ # XXX what changed
50
+ type_attr = node.attributes['type'].value if node.attributes['type'] and not type_attr
51
+
52
+ type = type_attr if type_attr
53
+
54
+ if action = BUILTIN_TYPE_ACTIONS[type]
55
+ case action
56
+ when :string
57
+ node.content
58
+ when :boolean
59
+ node.content == '1' || node.content == 'true'
60
+ when :int
61
+ node.content.to_i
62
+ when :float
63
+ node.content.to_f
64
+ when :date
65
+ leaf_date node
66
+ when :binary
67
+ leaf_binary node
68
+ when :keyvalue
69
+ leaf_keyvalue node
70
+ else raise
71
+ end
72
+ else
73
+ type = type.split(':', 2)[1] if type =~ /:/
74
+ if type =~ /^ArrayOf/
75
+ type = DEMANGLED_ARRAY_TYPES[$'] || $'
76
+ return node.children.select(&:element?).map { |c| deserialize c, type }
77
+ end
78
+ type = type.split(':', 2)[1] if type =~ /:/
79
+
80
+ klass = @loader.get(type) or raise "no such type '#{type}'"
81
+ case klass.kind
82
+ when :data
83
+ traverse_data node, klass
84
+ when :enum
85
+ node.content
86
+ when :managed
87
+ leaf_managed node, klass
88
+ else raise
89
+ end
96
90
  end
97
91
  end
98
- end
99
92
 
100
- def traverse_data node, klass
101
- obj = klass.new nil
102
- props = obj.props
103
- children = node.children.select(&:element?)
104
- i = 0
93
+ def traverse_data node, klass
94
+ obj = klass.new nil
95
+ props = obj.props
96
+ children = node.children.select(&:element?)
97
+ i = 0
105
98
 
106
- klass.full_props_desc.each do |desc|
107
- name = desc['name']
108
- child_type = desc['wsdl_type']
99
+ klass.full_props_desc.each do |desc|
100
+ name = desc['name']
101
+ child_type = desc['wsdl_type']
109
102
 
110
- # Ignore unknown fields
111
- while child = children[i] and not klass.full_props_set.member? child.name
112
- i += 1
113
- end
103
+ # Ignore unknown fields
104
+ while child = children[i] and not klass.full_props_set.member? child.name
105
+ i += 1
106
+ end
114
107
 
115
- if desc['is-array']
116
- a = []
117
- while ((child = children[i]) && (child.name == name))
118
- child = children[i]
119
- a << deserialize(child, child_type)
108
+ if desc['is-array']
109
+ a = []
110
+ while ((child = children[i]) && (child.name == name))
111
+ child = children[i]
112
+ a << deserialize(child, child_type)
113
+ i += 1
114
+ end
115
+ props[name.to_sym] = a
116
+ elsif ((child = children[i]) && (child.name == name))
117
+ props[name.to_sym] = deserialize(child, child_type)
120
118
  i += 1
121
119
  end
122
- props[name.to_sym] = a
123
- elsif ((child = children[i]) && (child.name == name))
124
- props[name.to_sym] = deserialize(child, child_type)
125
- i += 1
126
120
  end
121
+
122
+ obj
127
123
  end
128
124
 
129
- obj
130
- end
125
+ def leaf_managed node, klass
126
+ type_attr = node['type']
127
+ klass = @loader.get(type_attr) if type_attr
128
+ klass.new(@conn, node.content)
129
+ end
131
130
 
132
- def leaf_managed node, klass
133
- type_attr = node['type']
134
- klass = @loader.get(type_attr) if type_attr
135
- klass.new(@conn, node.content)
136
- end
131
+ def leaf_date node
132
+ Time.parse node.content
133
+ end
137
134
 
138
- def leaf_date node
139
- Time.parse node.content
140
- end
135
+ def leaf_binary node
136
+ node.content.unpack('m')[0]
137
+ end
141
138
 
142
- def leaf_binary node
143
- node.content.unpack('m')[0]
144
- end
139
+ # XXX does the value need to be deserialized?
140
+ def leaf_keyvalue node
141
+ h = {}
142
+ node.children.each do |child|
143
+ next unless child.element?
145
144
 
146
- # XXX does the value need to be deserialized?
147
- def leaf_keyvalue node
148
- h = {}
149
- node.children.each do |child|
150
- next unless child.element?
151
- h[child.name] = child.content
145
+ h[child.name] = child.content
146
+ end
147
+ [h['key'], h['value']]
152
148
  end
153
- [h['key'], h['value']]
154
149
  end
155
- end
156
-
157
- class OldDeserializer
158
- NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance'
159
150
 
160
- def initialize conn
161
- @conn = conn
162
- end
151
+ class OldDeserializer
152
+ NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance'
163
153
 
164
- def deserialize xml, typename=nil
165
- if IS_JRUBY
166
- type_attr = xml.attribute_nodes.find { |a| a.name == 'type' &&
167
- a.namespace &&
168
- a.namespace.prefix == 'xsi' }
169
- else
170
- type_attr = xml.attribute_with_ns('type', NS_XSI)
154
+ def initialize conn
155
+ @conn = conn
171
156
  end
172
- typename = (type_attr || typename).to_s
173
157
 
174
- if typename =~ /^ArrayOf/
175
- typename = demangle_array_type $'
176
- return xml.children.select(&:element?).map { |c| deserialize c, typename }
177
- end
158
+ def deserialize xml, typename=nil
159
+ if IS_JRUBY
160
+ type_attr = xml.attribute_nodes.find { |a| a.name == 'type' &&
161
+ a.namespace &&
162
+ a.namespace.prefix == 'xsi' }
163
+ else
164
+ type_attr = xml.attribute_with_ns('type', NS_XSI)
165
+ end
166
+ typename = (type_attr || typename).to_s
178
167
 
179
- t = @conn.type typename
180
- if t <= BasicTypes::DataObject
181
- props_desc = t.full_props_desc
182
- h = {}
183
- props_desc.select { |d| d['is-array'] }.each { |d| h[d['name'].to_sym] = [] }
184
- xml.children.each do |c|
185
- next unless c.element?
186
- field = c.name.to_sym
187
- d = t.find_prop_desc(field.to_s) or next
188
- o = deserialize c, d['wsdl_type']
189
- if h[field].is_a? Array
190
- h[field] << o
191
- else
192
- h[field] = o
193
- end
168
+ if typename =~ /^ArrayOf/
169
+ typename = demangle_array_type $'
170
+ return xml.children.select(&:element?).map { |c| deserialize c, typename }
194
171
  end
195
- t.new h
196
- elsif t == BasicTypes::ManagedObjectReference
197
- @conn.type(xml['type']).new @conn, xml.text
198
- elsif t <= BasicTypes::ManagedObject
199
- @conn.type(xml['type'] || t.wsdl_name).new @conn, xml.text
200
- elsif t <= BasicTypes::Enum
201
- xml.text
202
- elsif t <= BasicTypes::KeyValue
203
- h = {}
204
- xml.children.each do |c|
205
- next unless c.element?
206
- h[c.name] = c.text
172
+
173
+ t = @conn.type typename
174
+ if t <= BasicTypes::DataObject
175
+ props_desc = t.full_props_desc
176
+ h = {}
177
+ props_desc.select { |d| d['is-array'] }.each { |d| h[d['name'].to_sym] = [] }
178
+ xml.children.each do |c|
179
+ next unless c.element?
180
+
181
+ field = c.name.to_sym
182
+ d = t.find_prop_desc(field.to_s) or next
183
+ o = deserialize c, d['wsdl_type']
184
+ if h[field].is_a? Array
185
+ h[field] << o
186
+ else
187
+ h[field] = o
188
+ end
189
+ end
190
+ t.new h
191
+ elsif t == BasicTypes::ManagedObjectReference
192
+ @conn.type(xml['type']).new @conn, xml.text
193
+ elsif t <= BasicTypes::ManagedObject
194
+ @conn.type(xml['type'] || t.wsdl_name).new @conn, xml.text
195
+ elsif t <= BasicTypes::Enum
196
+ xml.text
197
+ elsif t <= BasicTypes::KeyValue
198
+ h = {}
199
+ xml.children.each do |c|
200
+ next unless c.element?
201
+
202
+ h[c.name] = c.text
203
+ end
204
+ [h['key'], h['value']]
205
+ elsif t <= String
206
+ xml.text
207
+ elsif t <= Symbol
208
+ xml.text.to_sym
209
+ elsif t <= Integer
210
+ xml.text.to_i
211
+ elsif t <= Float
212
+ xml.text.to_f
213
+ elsif t <= Time
214
+ Time.parse xml.text
215
+ elsif t == BasicTypes::Boolean
216
+ xml.text == 'true' || xml.text == '1'
217
+ elsif t == BasicTypes::Binary
218
+ xml.text.unpack('m')[0]
219
+ elsif t == BasicTypes::AnyType
220
+ raise 'attempted to deserialize an AnyType'
221
+ else raise "unexpected type #{t.inspect} (#{t.ancestors * '/'})"
207
222
  end
208
- [h['key'], h['value']]
209
- elsif t <= String
210
- xml.text
211
- elsif t <= Symbol
212
- xml.text.to_sym
213
- elsif t <= Integer
214
- xml.text.to_i
215
- elsif t <= Float
216
- xml.text.to_f
217
- elsif t <= Time
218
- Time.parse xml.text
219
- elsif t == BasicTypes::Boolean
220
- xml.text == 'true' || xml.text == '1'
221
- elsif t == BasicTypes::Binary
222
- xml.text.unpack('m')[0]
223
- elsif t == BasicTypes::AnyType
224
- fail "attempted to deserialize an AnyType"
225
- else fail "unexpected type #{t.inspect} (#{t.ancestors * '/'})"
223
+ rescue
224
+ $stderr.puts "#{$!.class} while deserializing #{xml.name} (#{typename}):"
225
+ $stderr.puts xml.to_s
226
+ raise
226
227
  end
227
- rescue
228
- $stderr.puts "#{$!.class} while deserializing #{xml.name} (#{typename}):"
229
- $stderr.puts xml.to_s
230
- raise
231
- end
232
228
 
233
- def demangle_array_type x
234
- case x
235
- when 'AnyType' then 'anyType'
236
- when 'DateTime' then 'dateTime'
237
- when 'Boolean', 'String', 'Byte', 'Short', 'Int', 'Long', 'Float', 'Double' then x.downcase
238
- else x
229
+ def demangle_array_type x
230
+ case x
231
+ when 'AnyType' then 'anyType'
232
+ when 'DateTime' then 'dateTime'
233
+ when 'Boolean', 'String', 'Byte', 'Short', 'Int', 'Long', 'Float', 'Double' then x.downcase
234
+ else x
235
+ end
239
236
  end
240
237
  end
241
- end
242
238
 
243
- if ENV['RBVMOMI_NEW_DESERIALIZER'] == '1' || true # Always use new one now
244
- Deserializer = NewDeserializer
245
- else
246
- Deserializer = OldDeserializer
247
- end
239
+ if ENV['RBVMOMI_NEW_DESERIALIZER'] == '1' || true # Always use new one now
240
+ Deserializer = NewDeserializer
241
+ else
242
+ Deserializer = OldDeserializer
243
+ end
248
244
 
249
245
  end
data/lib/rbvmomi/fault.rb CHANGED
@@ -1,19 +1,20 @@
1
+ # frozen_string_literal: true
1
2
  # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
2
3
  # SPDX-License-Identifier: MIT
3
4
 
4
5
  module RbVmomi
5
6
 
6
- class Fault < StandardError
7
- attr_reader :fault
7
+ class Fault < StandardError
8
+ attr_reader :fault
8
9
 
9
- def initialize msg, fault
10
- super "#{fault.class.wsdl_name}: #{msg}"
11
- @fault = fault
12
- end
10
+ def initialize msg, fault
11
+ super "#{fault.class.wsdl_name}: #{msg}"
12
+ @fault = fault
13
+ end
13
14
 
14
- def method_missing *a
15
- @fault.send(*a)
15
+ def method_missing *a
16
+ @fault.send(*a)
17
+ end
16
18
  end
17
- end
18
19
 
19
20
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Copyright (c) 2010-2017 VMware, Inc. All Rights Reserved.
2
3
  # SPDX-License-Identifier: MIT
3
4
 
@@ -14,59 +15,59 @@ module Optimist
14
15
  # Descriptions are of the form:
15
16
  # <key>: <options> <environment variable> (<default>)
16
17
  # @see http://optimist.rubyforge.org/
17
- class Parser
18
- # Options used by VIM.connect
19
- #
20
- # !!!plain
21
- # host: -o --host RBVMOMI_HOST
22
- # port: --port RBVMOMI_PORT (443)
23
- # no-ssl: --no-ssl RBVMOMI_SSL (false)
24
- # insecure: -k --insecure RBVMOMI_INSECURE (false)
25
- # user: -u --user RBVMOMI_USER (root)
26
- # password: -p --password RBVMOMI_PASSWORD ()
27
- # path: --path RBVMOMI_PATH (/sdk)
28
- # debug: -d --debug RBVMOMI_DEBUG (false)
29
- def rbvmomi_connection_opts
30
- opt :host, "host", :type => :string, :short => 'o', :default => ENV['RBVMOMI_HOST']
31
- opt :port, "port", :type => :int, :short => :none, :default => (ENV.member?('RBVMOMI_PORT') ? ENV['RBVMOMI_PORT'].to_i : 443)
32
- opt :"no-ssl", "don't use ssl", :short => :none, :default => (ENV['RBVMOMI_SSL'] == '0')
33
- opt :insecure, "don't verify ssl certificate", :short => 'k', :default => (ENV['RBVMOMI_INSECURE'] == '1')
34
- opt :user, "username", :short => 'u', :default => (ENV['RBVMOMI_USER'] || 'root')
35
- opt :password, "password", :short => 'p', :default => (ENV['RBVMOMI_PASSWORD'] || '')
36
- opt :path, "SOAP endpoint path", :short => :none, :default => (ENV['RBVMOMI_PATH'] || '/sdk')
37
- opt :debug, "Log SOAP messages", :short => 'd', :default => (ENV['RBVMOMI_DEBUG'] || false)
38
- end
18
+ class Parser
19
+ # Options used by VIM.connect
20
+ #
21
+ # !!!plain
22
+ # host: -o --host RBVMOMI_HOST
23
+ # port: --port RBVMOMI_PORT (443)
24
+ # no-ssl: --no-ssl RBVMOMI_SSL (false)
25
+ # insecure: -k --insecure RBVMOMI_INSECURE (false)
26
+ # user: -u --user RBVMOMI_USER (root)
27
+ # password: -p --password RBVMOMI_PASSWORD ()
28
+ # path: --path RBVMOMI_PATH (/sdk)
29
+ # debug: -d --debug RBVMOMI_DEBUG (false)
30
+ def rbvmomi_connection_opts
31
+ opt :host, 'host', type: :string, short: 'o', default: ENV['RBVMOMI_HOST']
32
+ opt :port, 'port', type: :int, short: :none, default: (ENV.member?('RBVMOMI_PORT') ? ENV['RBVMOMI_PORT'].to_i : 443)
33
+ opt :"no-ssl", "don't use ssl", short: :none, default: (ENV['RBVMOMI_SSL'] == '0')
34
+ opt :insecure, "don't verify ssl certificate", short: 'k', default: (ENV['RBVMOMI_INSECURE'] == '1')
35
+ opt :user, 'username', short: 'u', default: (ENV['RBVMOMI_USER'] || 'root')
36
+ opt :password, 'password', short: 'p', default: (ENV['RBVMOMI_PASSWORD'] || '')
37
+ opt :path, 'SOAP endpoint path', short: :none, default: (ENV['RBVMOMI_PATH'] || '/sdk')
38
+ opt :debug, 'Log SOAP messages', short: 'd', default: (ENV['RBVMOMI_DEBUG'] || false)
39
+ end
39
40
 
40
- # Select a datacenter
41
- #
42
- # !!!plain
43
- # datacenter: -D --datacenter RBVMOMI_DATACENTER (ha-datacenter)
44
- def rbvmomi_datacenter_opt
45
- opt :datacenter, "datacenter", :type => :string, :short => "D", :default => (ENV['RBVMOMI_DATACENTER'] || 'ha-datacenter')
46
- end
41
+ # Select a datacenter
42
+ #
43
+ # !!!plain
44
+ # datacenter: -D --datacenter RBVMOMI_DATACENTER (ha-datacenter)
45
+ def rbvmomi_datacenter_opt
46
+ opt :datacenter, 'datacenter', type: :string, short: 'D', default: (ENV['RBVMOMI_DATACENTER'] || 'ha-datacenter')
47
+ end
47
48
 
48
- # Select a folder
49
- #
50
- # !!!plain
51
- # folder: -F --folder RBVMOMI_FOLDER ()
52
- def rbvmomi_folder_opt
53
- opt :folder, "VM folder", :type => :string, :short => "F", :default => (ENV['RBVMOMI_FOLDER'] || '')
54
- end
49
+ # Select a folder
50
+ #
51
+ # !!!plain
52
+ # folder: -F --folder RBVMOMI_FOLDER ()
53
+ def rbvmomi_folder_opt
54
+ opt :folder, 'VM folder', type: :string, short: 'F', default: (ENV['RBVMOMI_FOLDER'] || '')
55
+ end
55
56
 
56
- # Select a compute resource
57
- #
58
- # !!!plain
59
- # computer: -R --computer RBVMOMI_COMPUTER
60
- def rbvmomi_computer_opt
61
- opt :computer, "Compute resource", :type => :string, :short => "R", :default => (ENV['RBVMOMI_COMPUTER']||'ha-compute-res')
62
- end
57
+ # Select a compute resource
58
+ #
59
+ # !!!plain
60
+ # computer: -R --computer RBVMOMI_COMPUTER
61
+ def rbvmomi_computer_opt
62
+ opt :computer, 'Compute resource', type: :string, short: 'R', default: (ENV['RBVMOMI_COMPUTER']||'ha-compute-res')
63
+ end
63
64
 
64
- # Select a datastore
65
- #
66
- # !!!plain
67
- # datastore: -s --datastore RBVMOMI_DATASTORE (datastore1)
68
- def rbvmomi_datastore_opt
69
- opt :datastore, "Datastore", :short => 's', :default => (ENV['RBVMOMI_DATASTORE'] || 'datastore1')
65
+ # Select a datastore
66
+ #
67
+ # !!!plain
68
+ # datastore: -s --datastore RBVMOMI_DATASTORE (datastore1)
69
+ def rbvmomi_datastore_opt
70
+ opt :datastore, 'Datastore', short: 's', default: (ENV['RBVMOMI_DATASTORE'] || 'datastore1')
71
+ end
70
72
  end
71
73
  end
72
- end