Oracledb_session


#1

I am trying the following code, but its not working for me. Inspec version 1.24.0. HELLODB database up & running.

tnsping HELLODB

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 16-MAY-2017 08:48:31

Copyright © 1997, 2013, Oracle. All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxx)(PORT = 9101)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = HELLODB)))
OK (10 msec)

describe oracledb_session(user: ‘system’, pass: ‘test123’, sid: ‘HELLODB’, sqlplus_bin: ‘/u00/app/oracle/product/11.2.0.4/database/bin/sqlplus’).query(‘SELECT NAME FROM v$database;’) do
its(‘stdout’) { should eq(‘HELLODB’) }
end
end

I am getting following error.

×  Command echo "SELECT NAME FROM v$database;" | /u00/app/oracle/product/11.2.0.4/database/bin/sqlplus -s system/test123@localhost/HELLODB stdout should eq "HELLODB"

 expected: "HELLODB"
      got: ""

 (compared using ==)

Please help me.

Thanks
Bhanu


#2

Its actually taking wrong connection string “localhost/HELLODB” instead of just “HELLODB”.
I think its inspec code issue.

  • Bhanu

#3

Hi Bhanu. I believe you posted about this same issue in the #inspec slack channel, to which you received a reply but we didn’t hear back from you.

This sounds like it may be a bug, so I’d like to ask that you log a GitHub issue for it and provide as much information as you can to assist in troubleshooting. You can find the link here: https://github.com/chef/inspec/issues/new

Thanks!
~Adam


#4

Thanks Adam,

I raised issue.
Ticket details: Inspec oracledb_session resource not connecting to the database. #1821

Thanks
Bhanu