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

Bug #15878

Module puppetlabs/lvm: filesystem type is not safe

Added by Andre Nathan over 1 year ago. Updated 7 months 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

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


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 over 1 year ago

  • Category set to lvm

#2 Updated by Miguel Di Ciurcio Filho 7 months 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 7 months ago

  • Status changed from Unreviewed to Closed

Also available in: Atom PDF