Forgot about .any?, that is a lot better.


I'll update it ASAP.
-Jeff

On Mon, May 5, 2014 at 4:04 PM, Adrien Thebo <notifications@github.com>
wrote:

>> @@ -143,6 +143,17 @@ def self.lxc?
>>      return false
>>    end
>>  
>> +  ##
>> +  # docker? returns true if the process is running inside of a docker container.
>> +  # Implementation derived from observation of a boot2docker system
>> +  def self.docker?
>> +    path = Pathname.new('/proc/1/cgroup')
>> +    return false unless path.readable?
>> +    hierarchies = path.readlines.map {|l| l.split(":")[2].to_s.start_with? '/docker/' }
> Why not do something like
> ```ruby
> path.readlines.any? { |l| l.split(":")[2].to_s.start_with? '/docker/' }
> ```
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/puppetlabs/facter/pull/672/files#r12304582