@@ -200,15 +200,22 @@ def size=(new_size)
200200 lvextend ( '-L' , new_size , path ) || fail ( "Cannot extend to size #{ new_size } because lvextend failed." )
201201
202202 unless @resource [ :resize_fs ] == :false or @resource [ :resize_fs ] == false or @resource [ :resize_fs ] == 'false'
203- blkid_type = blkid ( path )
204- if command ( :resize4fs ) and blkid_type =~ /\b TYPE=\" (ext4)\" /
205- resize4fs ( path ) || fail ( "Cannot resize file system to size #{ new_size } because resize2fs failed." )
206- elsif blkid_type =~ /\b TYPE=\" (ext[34])\" /
207- resize2fs ( path ) || fail ( "Cannot resize file system to size #{ new_size } because resize2fs failed." )
208- elsif blkid_type =~ /\b TYPE=\" (xfs)\" /
209- xfs_growfs ( path ) || fail ( "Cannot resize filesystem to size #{ new_size } because xfs_growfs failed." )
210- elsif blkid_type =~ /\b TYPE=\" (swap)\" /
211- swapoff ( path ) && mkswap ( path ) && swapon ( path ) || fail ( "Cannot resize swap to size #{ new_size } because mkswap failed." )
203+ begin
204+ blkid_type = blkid ( path )
205+ if command ( :resize4fs ) and blkid_type =~ /\b TYPE=\" (ext4)\" /
206+ resize4fs ( path ) || fail ( "Cannot resize file system to size #{ new_size } because resize2fs failed." )
207+ elsif blkid_type =~ /\b TYPE=\" (ext[34])\" /
208+ resize2fs ( path ) || fail ( "Cannot resize file system to size #{ new_size } because resize2fs failed." )
209+ elsif blkid_type =~ /\b TYPE=\" (xfs)\" /
210+ xfs_growfs ( path ) || fail ( "Cannot resize filesystem to size #{ new_size } because xfs_growfs failed." )
211+ elsif blkid_type =~ /\b TYPE=\" (swap)\" /
212+ swapoff ( path ) && mkswap ( path ) && swapon ( path ) || fail ( "Cannot resize swap to size #{ new_size } because mkswap failed." )
213+ end
214+ rescue Puppet ::ExecutionFailure => detail
215+ ## If blkid returned 2, there is no filesystem present or the file doesn't exist. This should not be a failure.
216+ if detail . message =~ / returned 2:/
217+ Puppet . debug ( detail . message )
218+ end
212219 end
213220 end
214221
0 commit comments