Skip to content

Commit afdf1b3

Browse files
author
Siarhei Rasiukevich
committed
Fix physical_volumes provisioning with 'followsymlinks' enabled
1 parent a96170f commit afdf1b3

File tree

1 file changed

+16
-1
lines changed
  • lib/puppet/provider/volume_group

1 file changed

+16
-1
lines changed

lib/puppet/provider/volume_group/lvm.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,27 @@ def exists?
5858
end
5959

6060
def physical_volumes=(new_volumes = [])
61+
# Need to replace device path with real names, instead of symlink
62+
if @resource.parameter(:followsymlinks).value == :true then
63+
new_volume_real = []
64+
new_volumes.each do |s|
65+
if File.symlink?(s)
66+
device = File.expand_path(File.readlink(s), File.dirname(s))
67+
new_volume_real.push device
68+
else
69+
real_should.push s
70+
end
71+
end
72+
new_volumes = new_volume_real
73+
end
74+
75+
6176
# Only take action if createonly is false just to be safe
6277
# this is really only here to enforce the createonly setting
6378
# if something goes wrong in physical_volumes
6479
if @resource[:createonly].to_s == "false"
6580
existing_volumes = physical_volumes
66-
extraneous = existing_volumes - new_volumes
81+
extraneous = existing_volumes - new_volumes
6782
extraneous.each { |volume| reduce_with(volume) }
6883
missing = new_volumes - existing_volumes
6984
missing.each { |volume| extend_with(volume) }

0 commit comments

Comments
 (0)