I have used a bash resource with if… else loop
If “if” loop is getting executed, I want recipe to continue as written (next step is include_recipe )
which is happening now.
But if it goes to “else” loop I don’t want to execute next step of include_recipe. Want to skip that step and move to the next resource execution
how can I achieve that?
Snippet:
bash ‘Host registration with server’ do
cwd node[‘local’][‘download_dir’]
sensitive true
user "root"
code <<-EOH
# Login to server
<<<< steps to login to to server and check IP address >>
if [ $? != 0 ]
then
<<< check if host IP is not present then do registration>>
else
no action … need to skip next step of include_recipe 'gde_client"
fi
# Logout from server
./vmssc logout server
EOH
end
Invoke addGPtoHost recipe if guard point exists
if node[‘guardPointsList’].strip != ""
include_recipe 'gde_client::addGPtoHost’
end
( This recipe need to be executed only for “if” loop in bash resource or else skip and move to next part of execution)
How can I achieve that?