Skip to content
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

fix destructive behaviour on legacy distros #3

Open
wants to merge 1 commit into
base: master
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
16 changes: 16 additions & 0 deletions resources/disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
action :mklabel do
execute "parted #{new_resource.device} --script -- mklabel #{new_resource.label_type}" do
not_if "parted #{new_resource.device} --script -- print |grep 'Partition Table: #{new_resource.label_type}'"
environment({
'LANG' => 'C',
'LC_ALL' => 'C',
})
end
end

Expand All @@ -23,6 +27,10 @@
# Number Start End Size File system Name Flags
# 1 17.4kB 537GB 537GB xfs
not_if "parted #{new_resource.device} --script -- print |sed '1,/^Number/d' |grep #{new_resource.part_type}"
environment({
'LANG' => 'C',
'LC_ALL' => 'C',
})
end
end

Expand All @@ -32,6 +40,10 @@
# or
# /dev/sdb1: Linux rev 1.0 ext4 filesystem data, UUID=435fd604-cf17-4f5c-b39a-c9829a209ed5 (extents) (large files) (huge files)
not_if "file -sL #{new_resource.device} |grep -i #{new_resource.file_system}"
environment({
'LANG' => 'C',
'LC_ALL' => 'C',
})
end
end

Expand All @@ -40,6 +52,10 @@
# Number Start End Size Type File system Flags
# 1 1049kB 107GB 107GB primary boot
not_if "parted #{new_resource.device} --script -- print |grep '#{new_resource.flag_name}'"
environment({
'LANG' => 'C',
'LC_ALL' => 'C',
})
end
end

Expand Down