The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
Module puppetlabs/lvm: filesystem type is not safe
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.
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 5 months 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.