Skip to content

Fix undefined method '[]' for nil:NilClass when creating filesystem… #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/puppet/provider/filesystem/lvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ def destroy
end

def fstype
%r{\bTYPE=\"(\S+)\"}.match(blkid(@resource[:name]))[1]
type_match = %r{\bTYPE=\"(\S+)\"}.match(blkid(@resource[:name]))
# when creating FS on a non LVM partition that already exists but does not have FS
# blkid output does not contain `TYPE=....` -> type_match is nil
if type_match
type_match[1]
end
rescue Puppet::ExecutionFailure
nil
end
Expand Down