lib/fluent/plugin/ec2_metadata.rb in fluent-plugin-ec2-metadata-0.0.11 vs lib/fluent/plugin/ec2_metadata.rb in fluent-plugin-ec2-metadata-0.0.12

- old
+ new

@@ -21,10 +21,11 @@ } @placeholder_expander = PlaceholderExpander.new # get metadata first and then setup a refresh thread + @ec2_metadata = Hash.new set_metadata set_tag @refresh_thread = Thread.new { while true sleep @metadata_refresh_seconds @@ -59,10 +60,10 @@ ec2_metadata['subnet_id'] = get_metadata("network/interfaces/macs/#{ec2_metadata['mac']}/subnet-id") rescue ec2_metadata['subnet_id'] = nil $log.info "ec2-metadata: 'subnet_id' is undefined because #{ec2_metadata['instance_id']} is not in VPC}" end - @ec2_metadata=ec2_metadata + @ec2_metadata.merge!(ec2_metadata) end def get_dynamic_data(f) res = Net::HTTP.get_response("169.254.169.254", "/latest/dynamic/#{f}") raise Fluent::ConfigError, "ec2-dynamic-data: failed to get #{f}" unless res.is_a?(Net::HTTPSuccess)