The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:
Module puppetlabs/lvm: filesystem type is not safe
Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com
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
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.
#2 Updated by Miguel Di Ciurcio Filho over 2 years ago
I think the current code is much more reliable than the old one:
def fstype /TYPE=\"(\S+)\"/.match(blkid(@resource[:name])) rescue Puppet::ExecutionFailure nil end
If there is any better way to detect the presence of a filesystem, please reopen this ticket.