The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #15878

Module puppetlabs/lvm: filesystem type is not safe

Added by Andre Nathan about 3 years ago. Updated almost 2 years ago.

Status:ClosedStart date:08/08/2012
Priority:ImmediateDue date:
Assignee:-% Done:

0%

Category:lvmSpent time:-
Target version:-
Keywords: Branch:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

Hello

The logic to detect if a filesystem is present is implemented as follows:

 def exists?
   fstype != nil
 end
 def fstype
   mount('-f', '--guess-fstype', @resource[:name]).strip
 rescue Puppet::ExecutionFailure
   nil
 end

So if for whatever reason the mount command fails or returns a non-zero status (eg. because it ran out of memory or it segfaulted or the root partition was read-only or some other unpredictable situation), the fstype method will return nil, causing exists? to fail and the filesystem to be reformatted.

To be safe, the fstype test should only return nil if it’s sure there’s no filesystem in the device, and return non-nil in every other situation.

History

#1 Updated by William Van Hevelingen almost 3 years ago

  • Category set to lvm

#2 Updated by Miguel Di Ciurcio Filho almost 2 years ago

I think the current code is much more reliable than the old one:

def fstype
    /TYPE=\"(\S+)\"/.match(blkid(@resource[:name]))[1]
rescue Puppet::ExecutionFailure
    nil
end

If there is any better way to detect the presence of a filesystem, please reopen this ticket.

#3 Updated by Miguel Di Ciurcio Filho almost 2 years ago

  • Status changed from Unreviewed to Closed

Also available in: Atom PDF