I am having trouble in serverspec. I'm trying to check installed package version on ubuntu.
I am using this code:
describe 'java packages' do
it 'package openjdk-9-jre should be installed with the correct version' do
expect(package('openjdk-9-jre')).to be_installed.with_version('9~b114-0ubuntu1')
end
end
Serverspec run dpkg-query command to check package but escapes tilda character and it doesn't work. serverspec runs:
dpkg-query -f '${Status} ${Version}' -W openjdk-9-jre | grep -E '^(install|hold) ok installed 9\\~b114-0ubuntu1$'
instead of
dpkg-query -f '${Status} ${Version}' -W openjdk-9-jre | grep -E '^(install|hold) ok installed 9~b114-0ubuntu1$'
I don't know how to fix this?
Can anyone help me with this?
Thanks