Class: VagrantPlugins::VCloudAir::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::VCloudAir::Config
- Defined in:
- lib/vagrant-vcloudair/config.rb
Instance Attribute Summary collapse
-
#catalog ⇒ Object
catalog object (Hash).
-
#catalog_id ⇒ Object
catalog id (String).
-
#catalog_item ⇒ Object
catalog item object (Hash).
-
#catalog_name ⇒ String
Catalog Name where the item resides.
-
#cloud_id ⇒ String
The Dedicated Cloud to log in to (optional).
-
#cpus ⇒ Object
VM number of cpus (Integer).
-
#ip_allocation_type ⇒ String
IP allocation type.
-
#ip_dns ⇒ Array
DNS.
-
#ip_subnet ⇒ String
IP subnet.
-
#memory ⇒ Object
VM memory size in MB (Integer).
-
#nested_hypervisor ⇒ Object
NestedHypervisor (Bool).
-
#network_bridge ⇒ Bool
Bridge Mode.
-
#org ⇒ Object
org object (Hash).
-
#org_id ⇒ Object
org id (String).
-
#password ⇒ String
The password used to log in.
-
#upload_chunksize ⇒ Integer
Chunksize for upload in bytes (default 1048576 == 1M).
-
#username ⇒ String
The username used to log in.
-
#vapp_prefix ⇒ String
Name of the vApp prefix [optional, defaults to ‘Vagrant’ ].
-
#vAppId ⇒ Object
vApp Id (String).
-
#vAppName ⇒ Object
vApp Name (String).
-
#vcloudair_cnx ⇒ Object
connection handle.
-
#vdc ⇒ Object
vdc object (Hash).
-
#vdc_edge_gateway ⇒ String
Name of the edge gateway [optional].
-
#vdc_edge_gateway_ip ⇒ String
Public IP of the edge gateway [optional, required if :vdc_edge_gateway is specified].
-
#vdc_id ⇒ Object
vdc id (String).
-
#vdc_name ⇒ String
Virtual Data Center to be used.
-
#vdc_network_id ⇒ String
Virtual Data Center Network Id to be used.
-
#vdc_network_name ⇒ String
Virtual Data Center Network to be used.
Instance Method Summary collapse
Instance Attribute Details
#catalog ⇒ Object
catalog object (Hash)
115 116 117 |
# File 'lib/vagrant-vcloudair/config.rb', line 115 def catalog @catalog end |
#catalog_id ⇒ Object
catalog id (String)
118 119 120 |
# File 'lib/vagrant-vcloudair/config.rb', line 118 def catalog_id @catalog_id end |
#catalog_item ⇒ Object
catalog item object (Hash)
121 122 123 |
# File 'lib/vagrant-vcloudair/config.rb', line 121 def catalog_item @catalog_item end |
#catalog_name ⇒ String
Catalog Name where the item resides
27 28 29 |
# File 'lib/vagrant-vcloudair/config.rb', line 27 def catalog_name @catalog_name end |
#cloud_id ⇒ String
The Dedicated Cloud to log in to (optional)
12 13 14 |
# File 'lib/vagrant-vcloudair/config.rb', line 12 def cloud_id @cloud_id end |
#cpus ⇒ Object
VM number of cpus (Integer)
133 134 135 |
# File 'lib/vagrant-vcloudair/config.rb', line 133 def cpus @cpus end |
#ip_allocation_type ⇒ String
IP allocation type
57 58 59 |
# File 'lib/vagrant-vcloudair/config.rb', line 57 def ip_allocation_type @ip_allocation_type end |
#ip_dns ⇒ Array
DNS
67 68 69 |
# File 'lib/vagrant-vcloudair/config.rb', line 67 def ip_dns @ip_dns end |
#ip_subnet ⇒ String
IP subnet
62 63 64 |
# File 'lib/vagrant-vcloudair/config.rb', line 62 def ip_subnet @ip_subnet end |
#memory ⇒ Object
VM memory size in MB (Integer)
130 131 132 |
# File 'lib/vagrant-vcloudair/config.rb', line 130 def memory @memory end |
#nested_hypervisor ⇒ Object
NestedHypervisor (Bool)
136 137 138 |
# File 'lib/vagrant-vcloudair/config.rb', line 136 def nested_hypervisor @nested_hypervisor end |
#network_bridge ⇒ Bool
Bridge Mode
72 73 74 |
# File 'lib/vagrant-vcloudair/config.rb', line 72 def network_bridge @network_bridge end |
#org ⇒ Object
org object (Hash)
103 104 105 |
# File 'lib/vagrant-vcloudair/config.rb', line 103 def org @org end |
#org_id ⇒ Object
org id (String)
106 107 108 |
# File 'lib/vagrant-vcloudair/config.rb', line 106 def org_id @org_id end |
#password ⇒ String
The password used to log in
22 23 24 |
# File 'lib/vagrant-vcloudair/config.rb', line 22 def password @password end |
#upload_chunksize ⇒ Integer
Chunksize for upload in bytes (default 1048576 == 1M)
37 38 39 |
# File 'lib/vagrant-vcloudair/config.rb', line 37 def upload_chunksize @upload_chunksize end |
#username ⇒ String
The username used to log in
17 18 19 |
# File 'lib/vagrant-vcloudair/config.rb', line 17 def username @username end |
#vapp_prefix ⇒ String
Name of the vApp prefix [optional, defaults to ‘Vagrant’ ]
93 94 95 |
# File 'lib/vagrant-vcloudair/config.rb', line 93 def vapp_prefix @vapp_prefix end |
#vAppId ⇒ Object
vApp Id (String)
127 128 129 |
# File 'lib/vagrant-vcloudair/config.rb', line 127 def vAppId @vAppId end |
#vAppName ⇒ Object
vApp Name (String)
124 125 126 |
# File 'lib/vagrant-vcloudair/config.rb', line 124 def vAppName @vAppName end |
#vcloudair_cnx ⇒ Object
connection handle
100 101 102 |
# File 'lib/vagrant-vcloudair/config.rb', line 100 def vcloudair_cnx @vcloudair_cnx end |
#vdc ⇒ Object
vdc object (Hash)
109 110 111 |
# File 'lib/vagrant-vcloudair/config.rb', line 109 def vdc @vdc end |
#vdc_edge_gateway ⇒ String
Name of the edge gateway [optional]
82 83 84 |
# File 'lib/vagrant-vcloudair/config.rb', line 82 def vdc_edge_gateway @vdc_edge_gateway end |
#vdc_edge_gateway_ip ⇒ String
Public IP of the edge gateway [optional, required if :vdc_edge_gateway is specified]
88 89 90 |
# File 'lib/vagrant-vcloudair/config.rb', line 88 def vdc_edge_gateway_ip @vdc_edge_gateway_ip end |
#vdc_id ⇒ Object
vdc id (String)
112 113 114 |
# File 'lib/vagrant-vcloudair/config.rb', line 112 def vdc_id @vdc_id end |
#vdc_name ⇒ String
Virtual Data Center to be used
42 43 44 |
# File 'lib/vagrant-vcloudair/config.rb', line 42 def vdc_name @vdc_name end |
#vdc_network_id ⇒ String
Virtual Data Center Network Id to be used
52 53 54 |
# File 'lib/vagrant-vcloudair/config.rb', line 52 def vdc_network_id @vdc_network_id end |
#vdc_network_name ⇒ String
Virtual Data Center Network to be used
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 |