Installing oracle on windows?

setupexe = 'D:\database\setup.exe’
windows_package ‘setup.exe’ do
source "#{setupexe}"
installer_type :custom
options '-silent -nowelcome -nowait -noconfig -responseFile D:\database\response\db.rsp’
action :install
end

it is giving the following error in chef but installation is getting completed.

STDOUT:
STDERR:
---- End output of start “” /wait “d:\database\setup.exe” -silent-nowelcome-nowait-noconfig-responseFile D:\database\response\db.rsp & exit
%%%ERRORLEVEL%%%% ----
Ran start “” /wait “d:\database\setup.exe” -silent-nowelcome-nowait-noconfig-responseFile D:\database\response\db.rsp & exit %%%%ERRORLEVEL
%% returned 259

Some installers return non-zero exit codes for success which might be the case here. This is when the returns property is useful:

setupexe = 'D:\database\setup.exe’

windows_package ‘setup.exe’ do
  source "#{setupexe}"
  installer_type :custom
  options '-silent -nowelcome -nowait -noconfig -responseFile D:\database\response\db.rsp’
  action :install
  returns 259
end

This lets Chef know that the value 259 is a valid exit code for success.

okay this is working fine but how can it non dependable on return or we canreturn dynamically for any exe file

One of the idiosyncrasies when using Windows is the vast array of error codes it provides so for many installers you will need to determine this by looking at their documentation. This isn’t a problem in the Unix/Linux world generally as installers generally respect the notion of 0 for success and 1 for failure. Chef can’t determine these dynamically any better than yourself as Windows installers that aren’t MSI/MSU are relatively non-standard and can do anything they choose.

thanks its work . can you suggest me the way i can create listners and dbca through chef

I don’t have any particular knowledge of configuring Oracle’s DB but there is an existing cookbook that you could use for reference here.

is there any way to to apply not_if condition if group exists
group ‘ora_dba’ do
members [‘oracle’,‘oraclebatch’]
append true
action :create
not_if {group.exist?(‘ora_dba’)}
end

options '-silent -nowelcome -nowait -noconfig -responseFile D:\database\response\db.rsp’

can i use it like this
path = 'D:\database\response\db.rsp’
options '-silent -nowelcome -nowait -noconfig -responseFile #{path}’

One of the core tenets of Chef is that it doesn't need to do work it's already done - recipes and resources are different from scripts in this regard, the resource will always create the group if needed but if it already exists and has no inputs, then there is nothing to do. This is a core concept of Chef and applies to all resources, save a few like execute or script which you need to guard yourself.

Yes, variable interpolation is the same in Chef as it is in Ruby, the language in which it is written.

actually i want to explain you scenario .

windows_package ‘setup.exe’ do
source "#{setupexe}"
installer_type :custom
options '-silent -nowelcome -nowait -noconfig -responseFile D:\database\response\db.rsp’
action :install
returns 259
end

this installation taking 15 mins to complete approx. But chef run is getting completed in 5 sec and resource after this like db creation on this software will run only when installation is completed. but chef will run other resource before the installation is completed.

and i want to add that the error (259) is coming only when i am using options

options '-silent -nowelcome -nowait -noconfig -responseFile D:\database\response\db.rsp’

that you suggest
returns 259

I use Chocolatey for app installs. I really like it, command line for one offs and a Chef resource thats been working for me. Also many packages are already made by the community.