I have the following in a LWRP, all it does is exploding an .ear file::
action :expand do
ear_folder = new_resource.target_folder
temp_folder = "#{::File.join(ear_folder, 'tmp_folder')}"
expand_ear(new_resource.source, ear_folder)
expand_wars(ear_folder,temp_folder)
end
def expand_ear(src,dest)
bash "unzip EAR" do
cwd dest
code <<-EOF
pwd
ls -l
jar -xvf #{src}
EOF
end
end
def explode_wars(src,dest)
Dir.glob("#{basepath}/*.war") do |file|
......... ###crete tmp folder, move .war there then unzip it to 'dest'
end
end
When I run this /using Vagrant provide/ the output shows that Chef starts 'expand_ear' and 'expand_wars' in parallel. As a consequence the expand_wars def fails to find all .wars /they are still being extracted. I tried making 'expand_ear' boolean and wrapping 'expand_wars' in :
if expand_ear?(src,dest)
expand_war
end
but this yields the same result.???