Issue #11566 has been updated by Feifei Jia.

Ken Barber wrote:
> Hey ... thanks for your submission :-).
>
> I like the technique you have used for changing the line-split type for 
> windows, but we are repeating the same code twice. Better to have the 
> line-split decided once and the arp lookup code defined once. Can you change 
> this accordingly?

You mean like this?

<pre>
def has_ec2_arp?
  is_amazon_arp = false
  if Facter.value(:operatingsystem) == 'windows'
    arp_table = Facter::Util::Resolution.exec('arp -a')
    ether_addr="fe-ff-ff-ff-ff-ff"
  else
    arp_table = Facter::Util::Resolution.exec('arp -an')
    ether_addr="fe:ff:ff:ff:ff:ff"
  end
  if not arp_table.nil?
    arp_table.each_line do |line|
      is_amazon_arp = true if line.include?(ether_addr)
      break
    end
  end
  is_amazon_arp
end
</pre>

I'm not a Ruby expert, but I'd like to make the code clean and neat. I did some 
test, only adding *("\r\n")* can let *arp_table* string split correctly. I'm 
not sure whether this is because Ruby dose not handle it well.

>
> I'm wary of taking any more code without tests for the EC2 fact since we've 
> stepped up this concern recently due to regression. The EC2 fact has no tests 
> and yet we've been changing it for some time. I'm going to put a dependency 
> on it for this ticket before it can be accepted. You don't necessarily need 
> to fix it yourself, but someone will have to fix it before we can take 
> another change to EC2 I think.

Is there any official way to determine if it in an EC2 environment or not?

Thanks.

----------------------------------------
Feature #11566: Windows EC2 meta data support
https://projects.puppetlabs.com/issues/11566

Author: Feifei Jia
Status: Code Insufficient
Priority: Normal
Assignee: 
Category: library
Target version: 1.6.x
Keywords: 
Branch: https://github.com/puppetlabs/facter/pull/125
Affected Facter version: 


Hi, I sent a pull request to support this feature, the link is here:

https://github.com/puppetlabs/facter/pull/125

Any feedback welcomed, thanks.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to