Class: VagrantPlugins::VCloud::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vcloud/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#add_hddsObject

Add hard disks to the VM (Array)

add_hdds: [ 20480 ]

169
170
171
# File 'lib/vagrant-vcloud/config.rb', line 169

def add_hdds
  @add_hdds
end

#advanced_networkObject

Use advanced networking settings (Bool = false)


153
154
155
# File 'lib/vagrant-vcloud/config.rb', line 153

def advanced_network
  @advanced_network
end

#auto_yes_for_uploadObject

Auto answer “Yes” to upload the box to vCloud (Bool = false)


218
219
220
# File 'lib/vagrant-vcloud/config.rb', line 218

def auto_yes_for_upload
  @auto_yes_for_upload
end

#catalogObject

catalog object (Hash)


126
127
128
# File 'lib/vagrant-vcloud/config.rb', line 126

def catalog
  @catalog
end

#catalog_idObject

catalog id (String)


129
130
131
# File 'lib/vagrant-vcloud/config.rb', line 129

def catalog_id
  @catalog_id
end

#catalog_itemObject

catalog item object (Hash)


132
133
134
# File 'lib/vagrant-vcloud/config.rb', line 132

def catalog_item
  @catalog_item
end

#catalog_item_nameString

Catalog Item to be used as a template

Returns:

  • (String)

38
39
40
# File 'lib/vagrant-vcloud/config.rb', line 38

def catalog_item_name
  @catalog_item_name
end

#catalog_nameString

Catalog Name where the item resides

Returns:

  • (String)

33
34
35
# File 'lib/vagrant-vcloud/config.rb', line 33

def catalog_name
  @catalog_name
end

#cpusObject

VM number of cpus (Integer)


144
145
146
# File 'lib/vagrant-vcloud/config.rb', line 144

def cpus
  @cpus
end

#dhcp_enabledObject

Turn DHCP on for this network (Bool = false)


195
196
197
# File 'lib/vagrant-vcloud/config.rb', line 195

def dhcp_enabled
  @dhcp_enabled
end

#dhcp_rangeObject

DHCP ip range if enabled (Array)


201
202
203
# File 'lib/vagrant-vcloud/config.rb', line 201

def dhcp_range
  @dhcp_range
end

#enable_guest_customizationObject

ability to disable gc for vms without tools installed


221
222
223
# File 'lib/vagrant-vcloud/config.rb', line 221

def enable_guest_customization
  @enable_guest_customization
end

#guest_customization_admin_auto_loginObject

guest customization admin auto login (Windows only) (Bool = false)


254
255
256
# File 'lib/vagrant-vcloud/config.rb', line 254

def 
  @guest_customization_admin_auto_login
end

#guest_customization_admin_auto_login_countObject

guest customization admin auto login count (Windows only) (Integer)


257
258
259
# File 'lib/vagrant-vcloud/config.rb', line 257

def 
  @guest_customization_admin_auto_login_count
end

#guest_customization_admin_passwordObject

guest customization specify admin password (String)


251
252
253
# File 'lib/vagrant-vcloud/config.rb', line 251

def guest_customization_admin_password
  @guest_customization_admin_password
end

#guest_customization_admin_password_autoObject

guest customization auto generate admin password (Bool = false)


248
249
250
# File 'lib/vagrant-vcloud/config.rb', line 248

def guest_customization_admin_password_auto
  @guest_customization_admin_password_auto
end

#guest_customization_admin_password_enabledObject

guest customization local admin (Bool = false)


245
246
247
# File 'lib/vagrant-vcloud/config.rb', line 245

def guest_customization_admin_password_enabled
  @guest_customization_admin_password_enabled
end

#guest_customization_admin_password_resetObject

guest customization admin require password reset (Bool = false)


263
264
265
# File 'lib/vagrant-vcloud/config.rb', line 263

def guest_customization_admin_password_reset
  @guest_customization_admin_password_reset
end

#guest_customization_change_sidObject

guest customization change sid setting (Windows only) (Bool = false)


227
228
229
# File 'lib/vagrant-vcloud/config.rb', line 227

def guest_customization_change_sid
  @guest_customization_change_sid
end

#guest_customization_domain_nameObject

guest customization domain name (Windows only) (String)


233
234
235
# File 'lib/vagrant-vcloud/config.rb', line 233

def guest_customization_domain_name
  @guest_customization_domain_name
end

#guest_customization_domain_ouObject

guest customization domain machine ou (Windows only) (String)


242
243
244
# File 'lib/vagrant-vcloud/config.rb', line 242

def guest_customization_domain_ou
  @guest_customization_domain_ou
end

#guest_customization_domain_user_nameObject

guest customization domain user name (Windows only) (String)


236
237
238
# File 'lib/vagrant-vcloud/config.rb', line 236

def guest_customization_domain_user_name
  @guest_customization_domain_user_name
end

#guest_customization_domain_user_passwordObject

guest customization domain user password (Windows only) (String)


239
240
241
# File 'lib/vagrant-vcloud/config.rb', line 239

def guest_customization_domain_user_password
  @guest_customization_domain_user_password
end

#guest_customization_join_domainObject

guest customization join domain (Windows only) (Bool = false)


230
231
232
# File 'lib/vagrant-vcloud/config.rb', line 230

def guest_customization_join_domain
  @guest_customization_join_domain
end

#guest_customization_scriptObject

scripts to run on machine boot


224
225
226
# File 'lib/vagrant-vcloud/config.rb', line 224

def guest_customization_script
  @guest_customization_script
end

#hostnameString

The vCloud Director hostname

Returns:

  • (String)

11
12
13
# File 'lib/vagrant-vcloud/config.rb', line 11

def hostname
  @hostname
end

#ip_allocation_typeString

IP allocation type

Returns:

  • (String)

63
64
65
# File 'lib/vagrant-vcloud/config.rb', line 63

def ip_allocation_type
  @ip_allocation_type
end

#ip_dnsArray

DNS

Returns:

  • (Array)

73
74
75
# File 'lib/vagrant-vcloud/config.rb', line 73

def ip_dns
  @ip_dns
end

#ip_subnetString

IP subnet

Returns:

  • (String)

68
69
70
# File 'lib/vagrant-vcloud/config.rb', line 68

def ip_subnet
  @ip_subnet
end

#memoryObject

VM memory size in MB (Integer)


141
142
143
# File 'lib/vagrant-vcloud/config.rb', line 141

def memory
  @memory
end

#metadata_vappObject

Add metadata to the vApp (Array)

metadata_vapp: [
  [ 'key', 'value' ]
]

208
209
210
# File 'lib/vagrant-vcloud/config.rb', line 208

def 
  @metadata_vapp
end

#metadata_vmObject

Add metadata to the VM (Array)

metadata_vapp: [
  [ 'key', 'value' ]
]

215
216
217
# File 'lib/vagrant-vcloud/config.rb', line 215

def 
  @metadata_vm
end

#nameString

Name of the VM [optional]

Returns:

  • (String)

104
105
106
# File 'lib/vagrant-vcloud/config.rb', line 104

def name
  @name
end

#nested_hypervisorObject

NestedHypervisor (Bool)


147
148
149
# File 'lib/vagrant-vcloud/config.rb', line 147

def nested_hypervisor
  @nested_hypervisor
end

#network_bridgeBool

Bridge Mode

Returns:

  • (Bool)

78
79
80
# File 'lib/vagrant-vcloud/config.rb', line 78

def network_bridge
  @network_bridge
end

#networksObject

Specify networks to add to the vApp (Hash)

networks: {
  org: [ 'Organization VDC network' ],
  vapp: [ {
            name: 'vApp network',
            ip_subnet: '172.16.4.0/255.255.255.0'
        } ]
}

164
165
166
# File 'lib/vagrant-vcloud/config.rb', line 164

def networks
  @networks
end

#nicsObject

Update / add network cards to the VM (Array) type is not updated for existing network cards

nics: [ {
  type: :vmxnet3,
  connected: true,
  network: "vApp network",
  primary: true,
  ip_mode: "static",
  ip: "10.10.10.1",
  mac: "00:50:56:00:00:01"
} ]

183
184
185
# File 'lib/vagrant-vcloud/config.rb', line 183

def nics
  @nics
end

#orgObject

org object (Hash)


114
115
116
# File 'lib/vagrant-vcloud/config.rb', line 114

def org
  @org
end

#org_idObject

org id (String)


117
118
119
# File 'lib/vagrant-vcloud/config.rb', line 117

def org_id
  @org_id
end

#org_nameString

The Organization Name to log in to

Returns:

  • (String)

16
17
18
# File 'lib/vagrant-vcloud/config.rb', line 16

def org_name
  @org_name
end

#ovf_propertiesObject

ovf properties object (Hash)


266
267
268
# File 'lib/vagrant-vcloud/config.rb', line 266

def ovf_properties
  @ovf_properties
end

#passwordString

The password used to log in

Returns:

  • (String)

26
27
28
# File 'lib/vagrant-vcloud/config.rb', line 26

def password
  @password
end

#pool_rangeObject

POOL ip range if dhcp is enabled (Array)


198
199
200
# File 'lib/vagrant-vcloud/config.rb', line 198

def pool_range
  @pool_range
end

#port_forwarding_rulesHash (readonly)

Port forwarding rules

Returns:

  • (Hash)

83
84
85
# File 'lib/vagrant-vcloud/config.rb', line 83

def port_forwarding_rules
  @port_forwarding_rules
end

#power_onObject

Power on the VM once created (Bool = true)


186
187
188
# File 'lib/vagrant-vcloud/config.rb', line 186

def power_on
  @power_on
end

#ssh_enabledObject

Attempt to connect via SSH to the VM (Bool = true)


189
190
191
# File 'lib/vagrant-vcloud/config.rb', line 189

def ssh_enabled
  @ssh_enabled
end

#sync_enabledObject

Attempt to sync files to the VM (Bool = true)


192
193
194
# File 'lib/vagrant-vcloud/config.rb', line 192

def sync_enabled
  @sync_enabled
end

#upload_chunksizeInteger

Chunksize for upload in bytes (default 1048576 == 1M)

Returns:

  • (Integer)

43
44
45
# File 'lib/vagrant-vcloud/config.rb', line 43

def upload_chunksize
  @upload_chunksize
end

#usernameString

The username used to log in

Returns:

  • (String)

21
22
23
# File 'lib/vagrant-vcloud/config.rb', line 21

def username
  @username
end

#vapp_nameObject

Specify a vApp name (String)


150
151
152
# File 'lib/vagrant-vcloud/config.rb', line 150

def vapp_name
  @vapp_name
end

#vapp_prefixString

Name of the vApp prefix [optional, defaults to 'Vagrant' ]

Returns:

  • (String)

99
100
101
# File 'lib/vagrant-vcloud/config.rb', line 99

def vapp_prefix
  @vapp_prefix
end

#vAppIdObject

vApp Id (String)


138
139
140
# File 'lib/vagrant-vcloud/config.rb', line 138

def vAppId
  @vAppId
end

#vAppNameObject

vApp Name (String)


135
136
137
# File 'lib/vagrant-vcloud/config.rb', line 135

def vAppName
  @vAppName
end

#vcloud_cnxObject

connection handle


111
112
113
# File 'lib/vagrant-vcloud/config.rb', line 111

def vcloud_cnx
  @vcloud_cnx
end

#vdcObject

vdc object (Hash)


120
121
122
# File 'lib/vagrant-vcloud/config.rb', line 120

def vdc
  @vdc
end

#vdc_edge_gatewayString

Name of the edge gateway [optional]

Returns:

  • (String)

88
89
90
# File 'lib/vagrant-vcloud/config.rb', line 88

def vdc_edge_gateway
  @vdc_edge_gateway
end

#vdc_edge_gateway_ipString

Public IP of the edge gateway [optional, required if :vdc_edge_gateway is specified]

Returns:

  • (String)

94
95
96
# File 'lib/vagrant-vcloud/config.rb', line 94

def vdc_edge_gateway_ip
  @vdc_edge_gateway_ip
end

#vdc_idObject

vdc id (String)


123
124
125
# File 'lib/vagrant-vcloud/config.rb', line 123

def vdc_id
  @vdc_id
end

#vdc_nameString

Virtual Data Center to be used

Returns:

  • (String)

48
49
50
# File 'lib/vagrant-vcloud/config.rb', line 48

def vdc_name
  @vdc_name
end

#vdc_network_idString

Virtual Data Center Network Id to be used

Returns:

  • (String)

58
59
60
# File 'lib/vagrant-vcloud/config.rb', line 58

def vdc_network_id
  @vdc_network_id
end

#vdc_network_nameString

Virtual Data Center Network to be used

Returns:

  • (String)

53
54
55
# File 'lib/vagrant-vcloud/config.rb', line 53

def vdc_network_name
  @vdc_network_name
end

Instance Method Details

#validate(machine) ⇒ Object


268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/vagrant-vcloud/config.rb', line 268

def validate(machine)
  errors = _detected_errors

  # TODO: add blank?
  errors << I18n.t('vagrant_vcloud.config.hostname') if hostname.nil?
  errors << I18n.t('vagrant_vcloud.config.org_name') if org_name.nil?
  errors << I18n.t('vagrant_vcloud.config.username') if username.nil?
  errors << I18n.t('vagrant_vcloud.config.password') if password.nil?

  unless ip_dns.nil?
    unless ip_dns.kind_of?(Array)
      errors << I18n.t('vagrant_vcloud.config.ip_dns')
    end
  end

  if catalog_name.nil?
    errors << I18n.t('vagrant_vcloud.config.catalog_name')
  end

  if vdc_name.nil?
    errors << I18n.t('vagrant_vcloud.config.vdc_name')
  end

  if networks.nil? && vdc_network_name.nil?
    errors << I18n.t('vagrant_vcloud.config.vdc_network_name')
  end

  # guest customization
  if enable_guest_customization.nil? ||
     enable_guest_customization == false
    if guest_customization_change_sid == true
      errors << I18n.t('vagrant_vcloud.gc.change_sid')
    end
    if !guest_customization_admin_password_enabled.nil?
      errors << I18n.t('vagrant_vcloud.gc.admin_password')
    end
    if !guest_customization_admin_password_reset.nil?
      errors << I18n.t('vagrant_vcloud.gc.admin_password_reset')
    end
    if !guest_customization_script.nil?
      errors << I18n.t('vagrant_vcloud.gc.script')
    end
  else
    if guest_customization_change_sid.nil? ||
       guest_customization_change_sid == false
      if guest_customization_join_domain == true
        errors << I18n.t('vagrant_vcloud.gc.domain')
      end
    else
      if guest_customization_join_domain == true
        if guest_customization_domain_name.nil? ||
           guest_customization_domain_user_name.nil? ||
           guest_customization_domain_user_password.nil?
          errors << I18n.t('vagrant_vcloud.gc.domain_join')
        end
      end
    end
    if guest_customization_admin_password_enabled.nil? ||
       guest_customization_admin_password_enabled == false
      if  == true
        errors << I18n.t('vagrant_vcloud.gc.auto_login')
      end
    else
      if  == true
        if guest_customization_admin_password_auto.nil? ||
           guest_customization_admin_password_auto == false
          if guest_customization_admin_password.nil? ||
             guest_customization_admin_password.empty?
            errors << I18n.t('vagrant_vcloud.gc.admin_password_gs')
          end
        end
        if .nil?
          errors << I18n.t('vagrant_vcloud.gc.auto_login_count_req')
        else
          if !(  >= 1 &&
                 <= 100 )
            errors << I18n.t('vagrant_vcloud.gc.auto_login_count')
          end
        end
      end
    end
  end

  { 'vCloud Provider' => errors }
end