Hi,
I’m trying to create a recipe that unzip some files then the behavior is depend on the content of the zipfile.
but I can’t figure put how to overcome the Compile vs Converge phase.
The directories are not exists before the recipe is executed so the command to get the sub directories must be inside a ruby block to fetch the data in runtime.
But once the command is inside the ruby block I can’t “read” the new values of the variables or attributes.
here is a sample:
ruby_block 'update patch attributes' do
block do
OPatchPath="#{node[:oracle][:rdbms][:ora_home]}/OPatch/#{Patch_No}"
Subdir_list = Dir.glob("#{OPatchPath}/*/")
Subdir_list.each do |dir|
Subdir_list.map! {|dir| dir.sub("#{OPatchPath}/", "")}
Subdir_list.map! {|dir| dir.sub('/', "")}
end
node.set[:oracle][:rdbms][:oracle_patch_list]=Subdir_list
end
end
## if there are no directories with numberes
if Subdir_list.find { |e| /^\d+$/ =~ e } == nil
do something
else
if Subdir_list.count == 2
do something else
else
do some other something
end
end
I did a deep research online and tried a lot of suggestions include using lazy, node.set, node.default node.run_state with no luck.
what am I missing?
any suggestions?
Thanks, Ofir.