Class: Bosh::AwsCloud::VipNetwork
- Defined in:
- lib/cloud/aws/vip_network.rb
Instance Method Summary collapse
-
#configure(ec2, instance) ⇒ Object
Configures vip network.
-
#initialize(name, spec) ⇒ VipNetwork
constructor
Creates a new vip network.
Methods included from Helpers
#cloud_error, #default_ephemeral_disk_mapping, #ebs_ephemeral_disk_mapping, #extract_security_groups
Constructor Details
#initialize(name, spec) ⇒ VipNetwork
Creates a new vip network
12 13 14 |
# File 'lib/cloud/aws/vip_network.rb', line 12 def initialize(name, spec) super end |
Instance Method Details
#configure(ec2, instance) ⇒ Object
Configures vip network
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cloud/aws/vip_network.rb', line 21 def configure(ec2, instance) if @ip.nil? cloud_error("No IP provided for vip network `#{@name}'") end elastic_ip = ec2.elastic_ips[@ip] @logger.info("Associating instance `#{instance.id}' " \ "with elastic IP `#{elastic_ip}'") # New elastic IP reservation supposed to clear the old one, # so no need to disassociate manually. Also, we don't check # if this IP is actually an allocated EC2 elastic IP, as # API call will fail in that case. errors = [AWS::EC2::Errors::IncorrectInstanceState] Bosh::Common.retryable(tries: 10, sleep: 1, on: errors) do instance.associate_elastic_ip(elastic_ip) true # need to return true to end the retries end end |