Class: VagrantPlugins::VCloudAir::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#catalogObject

catalog object (Hash)



115
116
117
# File 'lib/vagrant-vcloudair/config.rb', line 115

def catalog
  @catalog
end

#catalog_idObject

catalog id (String)



118
119
120
# File 'lib/vagrant-vcloudair/config.rb', line 118

def catalog_id
  @catalog_id
end

#catalog_itemObject

catalog item object (Hash)



121
122
123
# File 'lib/vagrant-vcloudair/config.rb', line 121

def catalog_item
  @catalog_item
end

#catalog_nameString

Catalog Name where the item resides

Returns:

  • (String)


27
28
29
# File 'lib/vagrant-vcloudair/config.rb', line 27

def catalog_name
  @catalog_name
end

#cloud_idString

The Dedicated Cloud to log in to (optional)

Returns:

  • (String)


12
13
14
# File 'lib/vagrant-vcloudair/config.rb', line 12

def cloud_id
  @cloud_id
end

#cpusObject

VM number of cpus (Integer)



133
134
135
# File 'lib/vagrant-vcloudair/config.rb', line 133

def cpus
  @cpus
end

#ip_allocation_typeString

IP allocation type

Returns:

  • (String)


57
58
59
# File 'lib/vagrant-vcloudair/config.rb', line 57

def ip_allocation_type
  @ip_allocation_type
end

#ip_dnsArray

DNS

Returns:

  • (Array)


67
68
69
# File 'lib/vagrant-vcloudair/config.rb', line 67

def ip_dns
  @ip_dns
end

#ip_subnetString

IP subnet

Returns:

  • (String)


62
63
64
# File 'lib/vagrant-vcloudair/config.rb', line 62

def ip_subnet
  @ip_subnet
end

#memoryObject

VM memory size in MB (Integer)



130
131
132
# File 'lib/vagrant-vcloudair/config.rb', line 130

def memory
  @memory
end

#nested_hypervisorObject

NestedHypervisor (Bool)



136
137
138
# File 'lib/vagrant-vcloudair/config.rb', line 136

def nested_hypervisor
  @nested_hypervisor
end

#network_bridgeBool

Bridge Mode

Returns:

  • (Bool)


72
73
74
# File 'lib/vagrant-vcloudair/config.rb', line 72

def network_bridge
  @network_bridge
end

#orgObject

org object (Hash)



103
104
105
# File 'lib/vagrant-vcloudair/config.rb', line 103

def org
  @org
end

#org_idObject

org id (String)



106
107
108
# File 'lib/vagrant-vcloudair/config.rb', line 106

def org_id
  @org_id
end

#passwordString

The password used to log in

Returns:

  • (String)


22
23
24
# File 'lib/vagrant-vcloudair/config.rb', line 22

def password
  @password
end

#upload_chunksizeInteger

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

Returns:

  • (Integer)


37
38
39
# File 'lib/vagrant-vcloudair/config.rb', line 37

def upload_chunksize
  @upload_chunksize
end

#usernameString

The username used to log in

Returns:

  • (String)


17
18
19
# File 'lib/vagrant-vcloudair/config.rb', line 17

def username
  @username
end

#vapp_prefixString

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

Returns:

  • (String)


93
94
95
# File 'lib/vagrant-vcloudair/config.rb', line 93

def vapp_prefix
  @vapp_prefix
end

#vAppIdObject

vApp Id (String)



127
128
129
# File 'lib/vagrant-vcloudair/config.rb', line 127

def vAppId
  @vAppId
end

#vAppNameObject

vApp Name (String)



124
125
126
# File 'lib/vagrant-vcloudair/config.rb', line 124

def vAppName
  @vAppName
end

#vcloudair_cnxObject

connection handle



100
101
102
# File 'lib/vagrant-vcloudair/config.rb', line 100

def vcloudair_cnx
  @vcloudair_cnx
end

#vdcObject

vdc object (Hash)



109
110
111
# File 'lib/vagrant-vcloudair/config.rb', line 109

def vdc
  @vdc
end

#vdc_edge_gatewayString

Name of the edge gateway [optional]

Returns:

  • (String)


82
83
84
# File 'lib/vagrant-vcloudair/config.rb', line 82

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)


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

def vdc_edge_gateway_ip
  @vdc_edge_gateway_ip
end

#vdc_idObject

vdc id (String)



112
113
114
# File 'lib/vagrant-vcloudair/config.rb', line 112

def vdc_id
  @vdc_id
end

#vdc_nameString

Virtual Data Center to be used

Returns:

  • (String)


42
43
44
# File 'lib/vagrant-vcloudair/config.rb', line 42

def vdc_name
  @vdc_name
end

#vdc_network_idString

Virtual Data Center Network Id to be used

Returns:

  • (String)


52
53
54
# File 'lib/vagrant-vcloudair/config.rb', line 52

def vdc_network_id
  @vdc_network_id
end

#vdc_network_nameString

Virtual Data Center Network to be used

Returns:

  • (String)


47
48
49
# File 'lib/vagrant-vcloudair/config.rb', line 47

def vdc_network_name
  @vdc_network_name
end

Instance Method Details

#validate(machine) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/vagrant-vcloudair/config.rb', line 138

def validate(machine)
  errors = _detected_errors

  errors << I18n.t('vagrant_vcloudair.errors.config.username') if username.nil?
  errors << I18n.t('vagrant_vcloudair.errors.config.password') if password.nil?

  unless ip_dns.nil?
    if ip_dns.kind_of?(Array)
      ip_dns.each do |dns|
        begin
          cidr = NetAddr::CIDR.create(dns)
        rescue NetAddr::ValidationError
          errors << I18n.t('vagrant_vcloudair.errors.config.dns_not_valid')
        end
        if cidr && cidr.bits < 32
          errors << I18n.t('vagrant_vcloudair.errors.config.dns_specified_as_subnet')
        end
      end
    else
      errors << I18n.t('vagrant_vcloudair.errors.config.ip_dns')
    end
  end

  unless vdc_edge_gateway_ip.nil?
    begin
      cidr = NetAddr::CIDR.create(vdc_edge_gateway_ip)
    rescue NetAddr::ValidationError
      errors << I18n.t('vagrant_vcloudair.errors.config.edge_gateway_ip_not_valid')
    end
    if cidr && cidr.bits < 32
      errors << I18n.t('vagrant_vcloudair.errors.config.edge_gateway_ip_specified_as_subnet')
    end
  end

  unless ip_subnet.nil?
    begin
      cidr = NetAddr::CIDR.create(ip_subnet)
    rescue NetAddr::ValidationError
      errors << I18n.t('vagrant_vcloudair.errors.config.ip_subnet_not_valid')
    end
    if cidr && cidr.bits > 30
      errors << I18n.t('vagrant_vcloudair.errors.config.ip_subnet_too_small')
    end
  end

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

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

  if vdc_network_name.nil?
    errors << I18n.t('vagrant_vcloudair.errors.config.vdc_network_name')
  end

  if network_bridge == true && (!vdc_edge_gateway.nil? || !vdc_edge_gateway_ip.nil?)
    errors << I18n.t('vagrant_vcloudair.errors.config.mixed_bridge')
  end

  if (vdc_edge_gateway.nil? && !vdc_edge_gateway_ip.nil?) || (!vdc_edge_gateway.nil? && vdc_edge_gateway_ip.nil?)
    errors << I18n.t('vagrant_vcloudair.errors.config.wrong_edge_configuration')
  end

  { 'VCloudAir Provider' => errors }
end