- confine :kernel => :linux
- addrs = []
- if FileTest.exist?("/bin/ip")
- %x{ip addr list}.each do |line|
- next unless line =~ /\s+inet/
- next if line =~ /scope (link|host)/
- if line =~ /\s+inet6\s+(\S+)\/\d{1,3} .*/
- addrs << $1
- end
- end
- end
- ret = addrs.join(",")
- if ret.empty?
- ret = 'no'
- end
- setcode do
- ret
- end
+ confine :kernel => :linux
+ addrs = []
+ if FileTest.exist?("/bin/ip")
+ %x{ip addr list}.each do |line|
+ next unless line =~ /\s+inet/
+ next if line =~ /scope (link|host)/
+ if line =~ /\s+inet6\s+(\S+)\/\d{1,3} .*/
+ addrs << $1
+ end
+ end
+ end
+ ret = addrs.join(",")
+ if ret.empty?
+ ret = ''
+ end
+ setcode do
+ ret
+ end