DevopsDevelop
DevopsDevelop

Reputation: 61

regex function in chef inspec output

I am using chef inspec for the postgressql. I am executing the below command to match the output "local0". Because the output can be local0 or local1 etc. so given % to match any number value. but getting error. pls advise.

  describe command("sudo -u postgres psql postgres -c \"show syslog_facility;\"") do
    its("stdout") { should match ('local%') }
  end

Upvotes: 0

Views: 748

Answers (1)

Mr.
Mr.

Reputation: 10122

you need to write a regular expression that matches your criteria.

the following might do the trick

describe command("sudo -u postgres psql postgres -c \"show syslog_facility;\"") do
  its("stdout") { should match /local(\d)*$/ }
end

Upvotes: 1

Related Questions