Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements and a Bugfix #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,13 @@
default[:oracle][:rdbms][:dbconsole][:sysman_pw] = 'sysman_pw_goes_here'
default[:oracle][:rdbms][:dbconsole][:notification_email] = '[email protected]'
default[:oracle][:rdbms][:dbconsole][:outgoing_mail] = 'mailhost'

## Has to be either true or false
default[:oracle][:is_ee_options_selectable] = false
## Which optional EE components to install. Comma separated string with extra components to install.
## Can be any or all of the following: oracle.rdbms.partitioning:11.2.0.3.0, oracle.oraolap:11.2.0.3.0, oracle.rdbms.dm:11.2.0.3.0,
## oracle.rdbms.dv:11.2.0.3.0, oracle.rdbms.lbac:11.2.0.3.0, oracle.rdbms.rat:11.2.0.3.0
default[:oracle][:optional_components] = ''

## DB creation takes an aweful long time. So we increse the timeout from 1h to 6h ... just to be on the safe side
default[:oracle][:rdbms][:dbcreate_timeout] = 21600
8 changes: 4 additions & 4 deletions recipes/cli_latest_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
unzip #{node[:oracle][:client][:install_dir]}/#{File.basename(node[:oracle][:client][:opatch_update_url])}
EOH3
end

# Making sure ocm.rsp response file is present.
if !node[:oracle][:client][:response_file_url].empty?
execute "fetch_response_file" do
command "curl #{node[:oracle][:curl_options]} #{node[:oracle][:client][:response_file_url]}"
user "oracli"
group 'oracli'
cwd node[:oracle][:client][:install_dir]
cwd node[:oracle][:client][:ora_home]
end
else
execute 'gen_response_file' do
Expand All @@ -73,10 +73,10 @@
notifies :create, "ruby_block[set_latest_patch_install_flag]", :immediately
notifies :create, "ruby_block[set_client_version_attr]", :immediately
end

# Set the rdbms version attribute.
include_recipe 'oracle::get_cli_version'

# Set flag indicating latest patch has been applied.
ruby_block 'set_latest_patch_install_flag' do
block do
Expand Down
8 changes: 5 additions & 3 deletions recipes/createdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Chef::Log.warn(":oracle[:rdbms][:dbs] is empty; no database will be created.")
end
action :create
only_if {node[:oracle][:rdbms][:dbs].empty?}
only_if { node[:oracle][:rdbms][:dbs].empty? }
end

node[:oracle][:rdbms][:dbs].each_key do |db|
Expand All @@ -69,6 +69,7 @@
group "oinstall"
environment (node[:oracle][:rdbms][:env])
code "dbca -silent -createDatabase -emConfiguration DBEXPRESS -templateName #{node[:oracle][:rdbms][:db_create_template]} -gdbname #{db} -sid #{db} -sysPassword #{node[:oracle][:rdbms][:sys_pw]} -systemPassword #{node[:oracle][:rdbms][:system_pw]}"
timeout node[:oracle][:rdbms][:dbcreate_timeout]
end

else
Expand All @@ -78,6 +79,7 @@
group "oinstall"
environment (node[:oracle][:rdbms][:env])
code "dbca -silent -createDatabase -templateName #{node[:oracle][:rdbms][:db_create_template]} -gdbname #{db} -sid #{db} -sysPassword #{node[:oracle][:rdbms][:sys_pw]} -systemPassword #{node[:oracle][:rdbms][:system_pw]}"
timeout node[:oracle][:rdbms][:dbcreate_timeout]
end

# Add to listener.ora a stanza describing the new DB.
Expand All @@ -99,7 +101,7 @@
end
action :create
end

# Configure dbcontrol.
if node[:oracle][:rdbms][:dbconsole][:emconfig]
# Creating em.rsp file for dbcontrol.
Expand Down Expand Up @@ -143,7 +145,7 @@
environment (node[:oracle][:rdbms][:env])
end
end

# Making sure shred is available
yum_package "coreutils" do
action :install
Expand Down
2 changes: 1 addition & 1 deletion recipes/get_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# - the version string: 11.2.0.3.5 in our example.
ruby_block 'set_rdbms_version_attr' do
block do
patch_info = %x(sudo -u oracle #{node[:oracle][:rdbms][:ora_home]}/OPatch/opatch lsinventory -bugs_fixed | grep -E '(#{node[:oracle][:rdbms][:latest_patch][:dirname]}) {3}\\1.* DATABASE PATCH SET UPDATE')
patch_info = %x(sudo -u oracle #{node[:oracle][:rdbms][:ora_home]}/OPatch/opatch lsinventory -bugs_fixed | grep -E '(#{node[:oracle][:rdbms][:latest_patch][:dirname]}) {3}\\1.* DATABASE PATCH SET UPDATE')
node.set[:oracle][:rdbms][:install_info][:patch_nr] = patch_info[/(?!^.+)\b\d+/]
node.set[:oracle][:rdbms][:install_info][:timestamp_str] = patch_info[/[MTWFS][a-z]+ [JFMASOND][a-z]+ \d{2} \d{2}:\d{2}:\d{2} [A-Z]+ \d{4}/]
node.set[:oracle][:rdbms][:install_info][:version_str] = patch_info[/(\d+\.)+\d+/]
Expand Down
3 changes: 2 additions & 1 deletion templates/default/db11R23.rsp.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ SELECTED_LANGUAGES=en
ORACLE_HOME=<%= node[:oracle][:rdbms][:ora_home] %>
ORACLE_BASE=<%= node[:oracle][:ora_base] %>
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.EEOptionsSelection=<%= node[:oracle][:is_ee_options_selectable] %>
oracle.install.db.optionalComponents=<%= node[:oracle][:optional_components] %>
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.isRACOneInstall=false
Expand Down