Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions lib/aws-eni/interface.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def info
raise Errors::MetaBadResponse unless Meta.interface(hwaddr, '', not_found: nil)
{
hwaddr: hwaddr,
instance_id: Meta.instance('instance-id'),
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was easier to just add this to the info's metadata than trying to pull it from lib/aws-eni.rb.

interface_id: Meta.interface(hwaddr, 'interface-id'),
subnet_id: Meta.interface(hwaddr, 'subnet-id'),
subnet_cidr: Meta.interface(hwaddr, 'subnet-ipv4-cidr-block')
Expand Down Expand Up @@ -233,17 +234,14 @@ def meta_ips

# Return a hash of local/public ip associations found in instance metadata
def public_ips
hwaddr = self.hwaddr
Hash[
Meta.connection do
Meta.interface(hwaddr, 'ipv4-associations/', not_found: '', cache: false).lines.map do |public_ip|
public_ip.strip!
unless private_ip = Meta.interface(hwaddr, "ipv4-associations/#{public_ip}", not_found: nil, cache: false)
raise Errors::MetaBadResponse
end
[ private_ip, public_ip ]
Client.describe_addresses(filters: [
{ name: 'domain', values: ['vpc'] },
{ name: 'instance-id', values: [info[:instance_id]] },
{ name: 'network-interface-id', values: [info[:interface_id]] }
]).addresses.map do |addr|
[ addr[:private_ip_address], addr[:public_ip] ]
end
end
]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/aws-eni/version.rb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Aws
module ENI
VERSION = "0.6.0"
VERSION = "0.6.1"
end
end