Reputation: 1686
Let's say I have 3 execute
resources 'Create users', 'Install client' and 'Verify client'.
How can I prevent execution of all those resources if one condition is satisfied ?
Something like:
block 'Manage client' do
execute 'Create users' do
cwd scripts_path
command './installClient.sh -create_users'
end
execute 'Install client' do
cwd scripts_path
command '/installClient.sh -installClient'
end
execute 'Verify client' do
cwd scripts_path
command './installClient.sh -verifyClient'
end
not_if { ::File.exists?('/tmp/client_configured_success') }
end
Upvotes: 0
Views: 86
Reputation: 54191
Use a normal if/unless
conditional like in any other Ruby code.
unless File.exist?('/tmp/client_configured_success')
execute 'Create users' do
cwd scripts_path
command './installClient.sh -create_users'
end
execute 'Install client' do
cwd scripts_path
command '/installClient.sh -installClient'
end
execute 'Verify client' do
cwd scripts_path
command './installClient.sh -verifyClient'
end
end
Upvotes: 1