mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
fix mysql resource (#1971)
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
This commit is contained in:
parent
8f247673e5
commit
50e762e492
1 changed files with 3 additions and 4 deletions
|
@ -33,7 +33,7 @@ module Inspec::Resources
|
|||
|
||||
# run the query
|
||||
command = "mysql -u#{@user} -p#{@pass}"
|
||||
if !socket.nil?
|
||||
if !@socket.nil?
|
||||
command += " -S #{@socket}"
|
||||
else
|
||||
command += " -h #{@host}"
|
||||
|
@ -43,10 +43,9 @@ module Inspec::Resources
|
|||
|
||||
cmd = inspec.command(command)
|
||||
out = cmd.stdout + "\n" + cmd.stderr
|
||||
if out =~ /Can't connect to .* MySQL server/ or
|
||||
out.downcase =~ /^error/
|
||||
if out =~ /Can't connect to .* MySQL server/ || out.downcase =~ /^error/
|
||||
# skip this test if the server can't run the query
|
||||
skip_resource("Can't connect to MySQL instance for SQL checks.")
|
||||
warn("Can't connect to MySQL instance for SQL checks.")
|
||||
end
|
||||
|
||||
# return the raw command output
|
||||
|
|
Loading…
Reference in a new issue