From b70c7b0c7c04a5bae18d858b03ecece9f2a07cac Mon Sep 17 00:00:00 2001 From: Siarhei Rasiukevich Date: Mon, 16 Sep 2019 16:37:46 +0300 Subject: [PATCH] Fix physical_volumes provisioning with 'followsymlinks' enabled --- lib/puppet/provider/volume_group/lvm.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/puppet/provider/volume_group/lvm.rb b/lib/puppet/provider/volume_group/lvm.rb index 46fcef32..23f0720a 100644 --- a/lib/puppet/provider/volume_group/lvm.rb +++ b/lib/puppet/provider/volume_group/lvm.rb @@ -58,6 +58,21 @@ 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