I’m not sure if this Chef/ruby, PowerShell or me missing something obvious but any help would be appreciated
I want to block code being run if the version of a file is newer than the one expected.
ruby ‘example_code’ do
& $installed_version = (Get-Item E:/Apps/application.exe).VersionInfo.FileVersion
& $installed_version = $installed_version.substring(0,4)
& $installed_version -replace “,”,"."
& $installed_version < “2”
If I run the first 3 PowerShell lines natively on the app server it returns the version of application.exe as 1.23.
Why then would the Chef code block execute everytime as not_if 1.23 is less than 2
I hope that makes sense. I tried single quotes / double quotes around the 2 no difference.
Any help appreciated.