Oracle DBA Resource

of Mainland

Subscriptions and Propaganda Office
Valley Fortress St, 6

Chef Inspec Test for Database

Chef Inspec Test can perform on database server which validate the resources availability and consistency as per desired stage. Inspec required to configured as bundle, on Windows Desktop systems using Powershell running as Administrator gem install bundlergem install chef-utils -v ‘16.6.14’gem install chef-config -v 16.6.14gem install chef-telemetry -v 1.0.14gem install inspec-bin -v 4.18.51gem install rubocop-rakegem…

Chef Inspec Test can perform on database server which validate the resources availability and consistency as per desired stage.

Inspec required to configured as bundle, on Windows Desktop systems using Powershell running as Administrator

gem install bundler
gem install chef-utils -v ‘16.6.14’
gem install chef-config -v 16.6.14
gem install chef-telemetry -v 1.0.14
gem install inspec-bin -v 4.18.51
gem install rubocop-rake
gem install yamllint -v 0.0.9
gem install inspec -v 4.18.51
gem install rake
gem install rubocop
gem install rubocop-rake
gem install rubocop-rspec

Sample code can be used to write ruby code

describe port(1521) do
 it { should_not be_listening }
end

describe user('oracle') do
 it { should exist }
 its('uid') { should eq 201 }
 its('shell') { should eq '/bin/ksh' }
end

describe file('/u01/app/oracle/product/19.0/dbhome1') do
 it { should be_directory }
 it { should be_owned_by 'oracle' }
end

describe kernel_parameter('kernel.shmmax') do
 its('value') { should eq 4294967295 }
end

describe bash('ls -al /u01/app/oracle/product/19.0/dbhome1/bin') do
 its('stdout') { should match /sqlplus/ }
 its('exit_status') { should eq 0 }
end

db_usr_con = oracledb_session(user: 'system', password: 'password', host: 'db_host', service: 'db_service')
describe db_usr_con.query('SELECT NAME AS VALUE FROM v$database;').row(0).column('value') do
  its('value') { should cmp 'BSPTSTUB' }
end

Run rubpcop to inspec the code

PS C:\codes> bundle exec rake lint
(in C:/codes )
Traceback (most recent call last):
11: from C:/opscode/inspec/embedded/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in require' 10: from C:/opscode/inspec/embedded/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:inrequire’
9: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/setup.rb:20:in <top (required)>' 8: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/ui/shell.rb:88:insilence’
7: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/ui/shell.rb:136:in with_level' 6: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/setup.rb:20:inblock in ‘
5: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler.rb:149:in setup' 4: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/runtime.rb:18:insetup’
3: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/definition.rb:244:in specs_for' 2: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/spec_set.rb:85:inmaterialize’
1: from C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/spec_set.rb:85:in map!' C:/Ruby2571-x64/lib/ruby/gems/2.5.0/gems/bundler-2.2.24/lib/bundler/spec_set.rb:90:inblock in materialize’: Could not find ed25519-1.2.4 in any of the sources (Bundler::GemNotFound)

Generate changelog for version 1.0.0

GitHub Changelog Generator not loaded, omitting tasks
Running RuboCop…
Inspecting 21 files
…………………

21 files inspected, no offenses detected
PS C:\workspace\Applications\Infra-testing\infra-testing\controls>