- From: Ravindra <
>
- To:
- Subject: [chef] only_if and not_if guard
- Date: Thu, 12 Dec 2013 04:26:00 -0800 (PST)
Hello All,
I'm writing a recipe where I'm trying to create a database in MSSQL. I've
written and execute resource, which is working fine. Now I want it to be
executed conditionally, if database exist do not execute the resource.
Irrespective of the condition the resource is getting executed every time.
The resource I'm using is given below.
execute "Create_DB" do
command "sqlcmd -S server -i C:\createDB.sql -o C"\Create_db.log"
not_if { "sqlcmd -U user -P secret -S server -b -Q \"select Count (*) from
master.dbo.sysdatabases WHERE name = 'myDB'\""
end
Am I doing anything wrong here?
Thanks
Ravi
- [chef] only_if and not_if guard, Ravindra, 12/12/2013
Archive powered by MHonArc 2.6.16.