Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

automation - Is there a syntax to remove the from the chef inspec output

When executing the below command:

  describe sql.query("show pgaudit.log;") do
    its("output") { should match 'ERROR: unrecognized configuration parameter "pgaudit.log"' }
  end

Getting error as below, is there any error with the syntax, kindly advise.

 expected: "ERROR: unrecognized configuration parameter "pgaudit.log""
      got: "
ERROR:  unrecognized configuration parameter "pgaudit.log"
"
question from:https://stackoverflow.com/questions/66058424/is-there-a-syntax-to-remove-the-n-from-the-chef-inspec-output

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you just have to run the query before the describe block, strip it and then use expect on it. something like:

sql_query = sql.query("show pgaudit.log;")
describe sql_query do
  its("output") { 
    expect(sql_query.stdout.strip).to eq('ERROR: unrecognized configuration parameter "pgaudit.log"')
  }
end

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...