ohai filesystem bug


Chronological Thread 
  • From: snacktime <snacktime@gmail.com>
  • To: chef@lists.opscode.com
  • Subject: ohai filesystem bug
  • Date: Tue, 2 Jun 2009 00:21:08 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=CRNKlK0XSsfO8iYWaFmXtTg0KAt5ZRwPK2Qu5TKgIsGStHKaRW5fF44RZ7AUQV/2Wa OoCenNC6abEMqUNt8mYrC3J2V2KculXq4otqT47WjPLBZv6AAVaHcyxFhxWJ0M7t82Wi LMZE7hlMY3zfPniORijENdzsyE3tMJ0Eez0hc=

mount -l produces extra output for the filesystem label that the current regex can't handle.  While fixing this I also ran into an issue with match variables.  For some reason, if you do any operations on them, like split, it wipes out the values of other match variables so they aren't available after that operation.  Anyways here is a minimally tested fix.

lines.each do |line|
  if line =~ /^(.+?) on (.+?) type (.+?) \((.+?)\)(?:\s\[(.*?)\]$|$)/
    md = Regexp.last_match
    filesystem = md[1]
    fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
    fs[filesystem][:mount] = md[2]
    fs[filesystem][:fs_type] = md[3]
    fs[filesystem][:mount_options] = md[4].split(",")
    fs[filesystem][:label] = md[5]
  end
end


  • ohai filesystem bug, snacktime, 06/02/2009

Archive powered by MHonArc 2.6.16.

§