Skip to content

Commit

Permalink
Fix physical_volumes provisioning with 'followsymlinks' enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Siarhei Rasiukevich committed Sep 17, 2019
1 parent a96170f commit afdf1b3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/puppet/provider/volume_group/lvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,27 @@ def exists?
end

def physical_volumes=(new_volumes = [])
# Need to replace device path with real names, instead of symlink
if @resource.parameter(:followsymlinks).value == :true then
new_volume_real = []
new_volumes.each do |s|
if File.symlink?(s)
device = File.expand_path(File.readlink(s), File.dirname(s))
new_volume_real.push device
else
real_should.push s
end
end
new_volumes = new_volume_real
end


# Only take action if createonly is false just to be safe
# this is really only here to enforce the createonly setting
# if something goes wrong in physical_volumes
if @resource[:createonly].to_s == "false"
existing_volumes = physical_volumes
extraneous = existing_volumes - new_volumes
extraneous = existing_volumes - new_volumes
extraneous.each { |volume| reduce_with(volume) }
missing = new_volumes - existing_volumes
missing.each { |volume| extend_with(volume) }
Expand Down

0 comments on commit afdf1b3

Please sign in to comment.