0

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
4

1 回答 1

1

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
于 2021-03-05T07:36:09.500 回答